Hi Paul,
I'm still fumbling my way around PowerShell with these sort of things, but
think I've come across it before.
Have you tried creating a PSObject in-line before piping to the Sort-Object
cmdlet?
I assume you're actually getting usage values for all sites
My environment is not returning the storage for all collections, which makes
this a bit difficult to verify. The piping new PSObjects to the Sort-Object
cmdlet seems to work
Try this.. hopefully I'm not confusing the situation
Cheers,
Michael
---------------------------
$thisFarm = [Microsoft.Sharepoint.Administration.SPFarm]::Local
$allsites = $thisFarm.Services | Where-Object { $_.TypeName -eq "Windows
SharePoint Services Web Application" } | ForEach-Object { $_.WebApplications }
| ForEach-Object { $_.Sites }
$allsites | ForEach-Object {
$siteusage = New-Object PSObject
$siteusage | Add-Member NoteProperty Url $_.Url
$siteusage | Add-Member NoteProperty Storage $_.Usage.Storage
$siteusage
} | Sort-Object -Descending -Property Storage
________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of
Web Admin
Sent: Monday, 13 August 2012 11:28 AM
To: ozMOSS
Subject: PowerShell - help with sorting sites by size
Hi all,
I'm creating an HTML email report in PowerShell that returns the following
table.
Name Site URL Size(MB) #Webs
VS 2010 /sites/dev 1.57 2
Site Test / 6.13 6
Team Site /sites/team 4.29 1
Apps /sites/apps 5.84 6
I would like to sort these by Size descending but am having no luck.
I have a collection of sites from a specified webapp.
$sites = $webapp.Sites
I then iterate through them with a foreach loop. I tried adding the sort
property to the $sites var but the usage property does not exist at this level.
It's a site property.
foreach ($site in ($sites | Sort-Object -Descending -Property usage.storage))
Do I need to store the above in another var and then sort it??
--
Regards,
Paul Noone
--
SharePoint Farm Admin/Developer
Infrastructure Team
CEO Sydney
p: (02) 9568 8461
f: (02) 9568 8483
e: [email protected]<mailto:[email protected]>
w: http://www.ceosyd.catholic.edu.au/
Gold Coast City Council - confidential communication
This email and any files transmitted with it are confidential and are intended
solely for the use of the addressee. If you are not the intended recipient be
advised that you have received this email in error and that any use,
dissemination, forwarding, printing or copying of this email and any file
attachments is strictly prohibited. If you have received this email in error,
please immediately notify us. You must destroy the original transmission and
its contents. Before opening or using attachments, check them for viruses and
defects. The contents of this email and its attachments may become scrambled,
truncated or altered in transmission. Please notify us of any anomalies. Our
liability is limited to resupplying the email and attached files or the cost of
having them resupplied.
_______________________________________________
ozmoss mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss