There are often times where it can be useful to gather a list of object properties in SharePoint for reporting, operations, or governance purposes. Fortunately, this is a very easy task in SharePoint 2010 with PowerShell. Once you have set up a variable to define your object (site collection, site, list, item, etc.), you can use a single line of script to output its properties to the PowerShell console or text file in a list or table format.
If you are viewing the properties of a single object, then the best command to use is Format-List, which simply lists each property on a separate line. For example, the script below lists the properties of a site:
$web = Get-SPWeb http://portal
$web | Format-List
The output will look as follows:
However, it is quite likely that you only want to show specific properties associated with an object, rather than a very long list of all of them. For example, you may want to show the name of the site along with its URL, owners, created date, and the date an item was last modified. Here you can use the following command:
$web | Format-List -property Title, Url, SiteAdministrators, Created, LastItemModifiedDate
This will show the following output:
To save this output to a text file, use the Out-File command, as follows:
$web | Format-List -property Title, Url, SiteAdministrators, Created, LastItemModifiedDate | Out-File -FilePath c:\webdetails.txt
If you would like to include other properties in addition or instead of those above, then use this command to list all properties available for the object:
$web | Get-Member -MemberType Property
Don’t forget to dispose of your SPWeb object properly when you’re finished:
$web.Dispose()
The Format-List command works well for single objects, but for multiple objects it is best to show the results in a table. The command to use here is Format-Table. For example, you may want to show a list of all sites in a site collection, along with the properties shown in the previous example for each site:
$site = Get-SPSite http://portal
$site | Get-SPWeb -limit all | Format-Table -wrap -property Title, Url, SiteAdministrators, Created, LastItemModifiedDate
The output to this command will look as follows:
To save this output to a file, use the Out-File command, as follows:
$site | Get-SPWeb -limit all | Format-Table -wrap -property Title, Url, SiteAdministrators, Created, LastItemModifiedDate | Out-File -FilePath c:\webdetails.txt
However, there is a problem with this format if you want to use the data in a CSV file. As you can see from the SiteAdministrators column in the screenshot above, the Format-Table cmdlet wraps longer passages of text to new lines in the text file. If you were to try and create a CSV file from this data, it would treat the wrapped text as a new line. To overcome this, there is quite a neat Export-Csv cmdlet available in PowerShell, which you can use in this example as follows:
$site | Get-SPWeb -limit all | Select-Object Title,Url,SiteAdministrators | Export-Csv -Path c:\webdetails.csv –notype
This will output to a CSV file in the following format:
"Title","Url","SiteAdministrators"
"PAC Portal","http://portal","Microsoft.SharePoint.SPUserCollection"
"Search","http://portal/search","Microsoft.SharePoint.SPUserCollection"
"Team",http://portal/team","Microsoft.SharePoint.SPUserCollection
We’re not done yet though. You will see from the output above that we have another problem – it has exported our SiteAdministrators property values as “Microsoft.SharePoint.SPUserCollection” instead of the comma-delimited list of site administrators that we got from the Format-Table command. The only way I can come up with to fix this is to perform a join for this type of multi-valued property. This can be done by replacing the property name in the Select-Object command with @{Name=’PropertyName’;Expression={[string]::join(";", ($_.PropertyName))}} instead. So for our example, the Export-Csv command will now look as follows:
$site | Get-SPWeb -limit all | Select-Object Title,Url,@{Name=’SiteAdministrators’;Expression={[string]::join(";", ($_.SiteAdministrators))}} | Export-Csv -Path c:\webdetails.csv –notype
This will fix the CSV file to look like this:
"Title","Url","SiteAdministrators"
"PAC Portal","http://portal","i:0#.w|pacdomain2\spadmin;i:0#.w|pacdomain2\phil.childs"
"Search","http://portal/search","i:0#.w|pacdomain2\spadmin;i:0#.w|pacdomain2\phil.childs"
"Team","http://portal/team","i:0#.w|pacdomain2\spadmin;i:0#.w|pacdomain2\phil.childs"
Don’t forget to dispose of your SPSite object properly when you’re finished:
$site.Dispose()
Hi great post! One question do you know if this can be done to sub sites? I need this same info but not for the root site, but the sub sites under the root site. There are about 100 sub sites and I would like to gather this info in a spreadsheet for those sites without having to run this command for all 100 sites individually.
ReplyDeleteGet-SPSite | Get-SPWeb -Limit all | ForEach-Object { $_ | Format-List -property Title, Url, SiteAdministrators, Created, LastItemModifiedDate}
ReplyDelete2015-12-7 xiaozhengm
ReplyDeleteadidas uk
nike free run
toms outlet
ugg outlet
michael kors outlet online
nike huarache trainers
polo ralph lauren
jordan 8
michael kors handbags
christian louboutin uk
running shoes
cheap uggs boots
air force 1
ralph lauren outlet
coach outlet
michael kors outlet
toms outlet
hermes uk
michael kors uk
ugg boots
fitflops clearance
michael kors uk
tory burch outlet
oakley sunglasses
nike outlet
louis vuitton outlet
louis vuitton pas cher
kate spade outlet
gucci outlet
coach outlet
michael kors outlet
canada goose uk
coach factory outlet
christian louboutin shoes
nike blazer
jordan 8s
michael kors handbags
jordan 3 infrared
caoch outlet
true religion outlet
ReplyDeleteGreat Article..
Online DotNet Training
.Net Online Training
Dot Net Training in Chennai
IT Training in Chennai
20160301meiqing
ReplyDeletethe north face jackets
abercrombie & fitch
louis vuitton outlet online
nike air huarache
michael kors
oakley sunglasses
cheap jerseys
ugg boots
tods outlet
north face outlet
hollister
uggs on sale
michael kors outlet
oakley outlet
michael kors handbags
cheap jordans
toms shoes
polo ralph lauren outlet
michael kors outlet
ray ban outlet
true religion jeans
michael kors outlet
louis vuitton
ray-ban sunglasses
retro jordans
canada goose jackets
michael kors online
abercrombie
kate spade handbags
coach factory outlet
louis vuitton outlet
louis vuitton outlet
oakley sunglasses
gucci bags
cheap oakleys
tory burch handbags
ray ban sunglasses outlet
louis vuitton
cheap uggs
michael kors outlet online
ReplyDeletepolo ralph lauren outlet
ferragamo
air max 90
asics running shoes
polo ralph lauren outlet online
tiffany jewelry
michael kors uk
prada sunglasses wholesale
adidas superstar white
birkenstocks
michael kors bags
oakley sunglasses outlet
moncler jackets
ralph lauren outlet
coach outlet online
michael kors uk
true religion sale
coach purses on sale
ralph lauren
adidas nmd r1
reebok
michael kors bags
christian louboutin uk
true religion outlet
lacoste shoes
jordans
armani exchange
cheap jordan shoes
tiffany uk
wholesale nike shoes
cheap jordans
2016721caiyan
ugg boots
ReplyDeletecoach outlet
fitflops sale
celine outlet
beats by dr dre
jordan shoes
nike trainers
michael kors handbags
nike free run
chrome hearts
chanyuan1011
dự án chung cư vinhomes nguyễn trãi là một quần thể đô thị hiện đại chung cu vinhomes nguyen trai được trang bị nội thất tinh tế thiết kế vinhomes nguyễn trãi sang trọng vinhomes nguyen trai đẳng cấp kết hợp cùng tiện nghi vinhome nguyen trai cao cấp vinhome nguyễn trãi là điểm đến lý tưởng vincom nguyen trai đầy đủ cho người tiêu dùng vincom nguyễn trãi có bán giày nam các loại giày công sở nam đẹp nhất, giày lười nam đẹp.Công ty thiết kế nội thất hàng đầu tại hà nội, chuyên thiet ke noi that
ReplyDeletehxy2.14
ReplyDeletetoms outlet
toms shoes
toms outlet
toms shoes
toms outlet
toms shoes
toms outlet
toms shoes
toms outlet
toms shoes
louis vuitton outlet
ReplyDeleteray ban sunglasses
chicago bulls jerseys
ugg boots
louis vuitton outlet
retro jordans
christian louboutin uk
jordan 8
michael kors outlet
calvin klein
20173.9chenjinyan
swarovski crystal
ReplyDeleterolex watches
nike store uk
louis vuitton outlet
coach factory outlet
burberry outlet
rolex watches
oakley sunglasses
coach outlet online
cheap jordans
20170323lck
coach outlet online
ReplyDeletechristian louboutin pas cher
polo ralph lauren outlet
ralph lauren sale clearance uk
nfl jerseys cheap
michael kors outlet canada
pandora charms
fitflop shoes
coach outlet online
nfl jerseys wholesale
0324shizhong
oakley sunglasses wholesale
ReplyDeletenike air max 1
michael kors outlet stores
michael kors outlet
adidas nmd runner
michael kors handbags
cheap oakley sunglasses
louis vuitton
coach outlet online
true religion jeans
chanyuan2017.06.08
birkin bags
ReplyDeletejordan 11 win like 96
cheap nfl jerseys
nmd r1
clarks shoes
cheap soccer cleats
fenty puma
pandora jewelry
curry shoes
nike factory
2018-0505y
This article is interesting and useful. Thank you for sharing. And let me share an article about health that God willing will be very useful. Thank you :)
ReplyDeletePenyebab Telat Haid dan Solusinya
Cara Menghilangkan Benjolan di Kelopak Mata
20180601xiaoke
ReplyDeletemichael kors outlet clearance
ray ban sunglasses sale
cheap jordans
polo ralph lauren shirts
49ers jerseys
calvin klein jeans
moncler
air jordan shoes
ugg outlet online
coach factory outlet
It is a time consuming process to locate a legitimate, high-quality designer Michael Kors Handbags On Sale at a decent price. One brand name that is sought after is the Michael Kors Bags On Sale. Anywhere you see high demand you will find people out to make a quick buck.
ReplyDeleteIt is a time consuming process to locate a legitimate, high-quality designer Michael Kors Handbags Clearance at a decent price. One brand name that is sought after is the Michael Kors Outlet Store. Anywhere you see high demand you will find people out to make a quick buck.
ReplyDeleteThanks for sharing the information
ReplyDeleteKhasiat QnC Jelly Gamat
Obat Eksim Atopik
Pengobatan Herbal Penyakit Liver
Cara Mengobati Alergi Dingin
Obat Paling Mujarab untuk Diabetes
PENGOBATAN PENYAKIT AMANDEL
Cara Mengatasi Penyakit Asam Lambung
https://myserviceshome.com/insulation-foam-in-riyadh/
ReplyDeletehttps://myserviceshome.com/detection-of-water-leaks-in-dammam/
https://myserviceshome.com/fighting-insects-in-riyadh/
https://myserviceshome.com/insulation-of-roofs-in-riyadh/
https://myserviceshome.com/detection-of-water-leaks/
Very Nice Blog Updation Keep Updating !!
ReplyDeleteCara Mengobati Penyakit Gagal Ginjal
Obat Penyakit Insomnia Paling Ampuh Tanpa Efek Samping
Obat Herbal Paling Ampuh Untuk Mengobati Penyakit Hipotiroid
Cara Alami Untuk Mengobati Batuk Kronis
Cara Mengobati Penyakit Usus Buntu
Pengobatan Kelenjar Tiroid
Designer Exposure es un buen lugar para comprar su Bolsos Michael Kors original.
ReplyDeleteThe Woven Tote es también una selección impresionante en el Bolsos Michael Kors Baratos.
Bolso de alta calidad que debe contemplar absolutamente un Bolsos Michael Kors Outlet.
Du kommer att upptäcka en handfull detaljer som du kan förvänta dig att komma över på en vanlig Michael Kors Rea.
Du kan hitta ett antal platser som ger Väska Michael Kors.
Sortimentet är fantastiskt för alla som letar efter en MK Väska.
Håll dina ögon öppna för den här säsongens val som kommer att presenteras under bara några månader och det kommer utan tvekan att bli spektakulärt.
cheap nfl jerseys
ReplyDeletecheap jerseys
cheap jerseys from china
wholesale jerseys
cheap nfl jerseys from china
china jerseys
nfl jerseys china
wholesale nfl jerseys
cheap authentic nfl jerseys
cheap jerseys online
cheap authentic jerseys
cheap sports jerseys
cheap wholesale jerseys
china wholesale jerseys
discount nfl jerseys
cheap authentic jerseys from china
discount jerseys
custom cowboys jersey
nfl jerseys cheap
cheap nfl jerseys china
authentic nfl jerseys
وتمتلك أجدد المواد الكيميائية العاملة على مكافحة جميع أشكال الحشرات، كما أنه آمن على الإطلاقً على الأطفال ولا يبقى ضرر في استعماله .
ReplyDeleteشركة مكافحة حشرات بالرس
شركة رش مبيدات بالرس
تطوير المبيدات الحشرية
ارخص شركة مكافحة حشرات
شركة اللمسة الأخيرة تقدم لك الحل الأمثل فلا حشرات بعد اليوم ولن تعود مرة أخرى. فنحن نستخدم أفضل المبيدات العالمية الفعالة صديقة البيئة التي لا تترك رائحة ولا سيوثر على صحة الأنسان ويقوم باستخدامها عمال مدربون يقومون برش المبيدات بشكل علمي مما يضمن لك الراحة التامة نرجو التواصل على هذا الرقم 0580002467
ReplyDeleteشركة رش مبيدات بأبها
شركة مكافحة حشرات بأبها
شركة مكافحة النمل الابيض بأبها
شركة رش مبيدات بخميس مشيط
شركة مكافحة حشرات بخميس مشيط
شركة مكافحة النمل الابيض بخميس مشيط
شركة رش مبيدات بالقصيم
شركة مكافحة حشرات بالقصيم
شركة مكافحة حشرات بجازان
شركة رش مبيدات بجازان
We wish you the best
ReplyDeleteشركة مكافحة حشرات بالقصيم
شركة مكافحة حشرات بينبع
شركة مكافحة حشرات بالخرج
Thank you for your effort
ReplyDeleteشركة مكافحة حشرات بالدمام
شركة مكافحة حشرات بالطائف
شركة مكافحة حشرات بالرياض
สล็อตออนไลน์
ReplyDeleteโกลเด้นสล็อต
goldenslot
golden slot
Both things are possible if you carry Michael Kors Handbags Wholesale. If you are a woman who goes for innovative designs, a designer Michael Kors Bags On Sale is perfect for you. Offering a huge selection of chic purses, handbags, shoes and accessories, Michael Kors Outlet Online Store celebrates womanhood in an entirely unique way. Michael Kors Factory Outlet Online Store At Wholesale Price are one of the most sought-after handbags worldwide. We all agree that diamonds are a woman's best friend; however Official Coach Factory Outlet Online are absolutely next in line. To Coach Outlet Sale aficionados, don't fret because we have great news: a discount Official Coach Outlet Online isn't hard to find. If you are a smart shopper looking for a good buy and great deals on your next handbag purchase, you can go to Official Coach Outlet Online.
ReplyDeleteFriendly Links: Toms Shoes Womens | Toms Clearance
Air Jordan 12 Retro Black White, Dr. Thomas Inglesby, Johns Hopkins. Brian Stokes Mitchell, the Actor's Fund. Jordan Black 1s, Even before the pandemic, 258 million children and youth were out of school worldwide. There have been so many missed opportunities in the past. This is a defining moment to rethink the future of education, and the transformation that could be achieved through universal access to high quality education.Today we must rise up to the previously unthinkable challenge of providing learning without schools.
ReplyDeleteDo your part to protect yourself if you feel like a deal is too good to be true, it usually is.Work at home scams. {tag: Yeezy Boost V3 White}Jordan 1 Black Red, There's strong voice work from Will Forte, Alessia Cara, Jane Krakowski, Martin Short and Terry Crews but Gervais and his droll narration steals the show. "It's hard to leave home for the first time," he says, "although I was six days old when I left. All my folks ever did for me was lick my eyeballs open and sent me packing.".
For most people, that's not too much of an issue. And the problems pretty much end there as far as headphones are concerned. Bluetooth in itself isn't infallible, of course, but that's another topic entirely. {tag: Adidas Yeezy Cream White 350 V2}
You try to just put your finger on what's happening, and then you get told to go home. {tag: Cloud White Yeezy Reflective Laces}"Police in Carrollton, near Dallas, arrested Lorraine Maradiaga, 18, late Tuesday morning after arranging her surrender to the city jail. {tag: Yeezy Boost Off White Yellow}
Black And Grey Jordan Shirt, The Honors College at Auburn University is home to nearly 1,500 of the best and brightest students from each of the university's academic colleges and schools. They may choose to become involved in undergraduate research and complete an Honors thesis or a professional presentation. They may also choose to enroll in graduate level courses, which can count toward their graduate degree if they continue at Auburn.Partnering with faculty across campus, the Honors College offers roughly 190 Honors courses each year with an average class size of 25 30.
Foltynewicz New Air Jordan Shoes (11 9) retired Ray Ban Outlet 13 straight batters after Evan Longoria two out double in the first. The right hander carried Cheap Nike Air Force 1 a shutout into the ninth before allowing Brandon Crawford two out RBI single. Atlanta starter struck out seven and walked one while finishing with 108 pitches.
ReplyDeleteA summer climbing MK Outlet and activity camp to get your kids climbing and keep them moving during summer vacation. Camps run for three consecutive days, Tues/Wed/Thurs, each week during summer break. Morning, mid afternoon and late afternoon sections offered in each 3 day session.
Along with Blue Bottle, Stumptown, Intelligentsia and Revelator, La Colombe is a coffee company that might be coming soon to a corner Coach Bags Clearance near you. The Philly based coffee roaster is helmed Jordan Shoes For Sale by Nike Air Force 1 Cheap Outlet one of the world's boldest coffee hunters (check out his Travel Channel show, Dangerous Grounds), who has led the company to pursue a perfect cup through innovations like Cheap Yeezy Shoes Sale proprietary brew methods and boundary pushing drinks like a canned latte (one that's actually good!). La Colombe's flagship Fishtown location offers the usual full espresso drink menu, a manual brew bar and the world's first ever draft latte.