2010 Pre-Upgrade Check

#Copy this text into a text document and save it as InfoScript.ps1
#Please login to your SharePoint server using an account that has permissions to run PowerShell Commands.
 # Place the file InfoScript.ps1 into a directory on the server that hosts SharePoint Central Administration.
 # Open the SharePoint 2010 Management Shell and type:
 # c:[directory where you placed the script]InfoScript2010.ps1 | Out-File -width 200 c:InfoOutput.txt
 # The "Out-File -width 200" part of the command is to make the output wider to fit more information on each line
 # Once the script has completed, please forward the InfoOutput.txt file to your Rackspace contact via email.
 #|
 #
add-pssnapin microsoft.sharepoint.powershell -ea 0
$scriptuser = whoami
 write-output "InfoScript was run under account name","------------------------------------", $scriptuser
write-output "Servers in farm, their upgrade status and version number (version is just for comparison)"
 # Added bit to weed out SQL and email servers
 Get-SPServer | Where-Object { $_.role -ne "invalid" } | Select Name, Role, NeedsUpgrade, Version | out-string -width 200
 write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Web Apps in Farm and if they are using claims auth or not"
Get-SPWebApplication |select DisplayName, URL, @{Label = "Claims Enabled?"; Expression = {$_.UseClaimsAuthentication}} |out-string -width 200
write-output "SharePoint Farm Build number"
 Get-SPFarm | Select BuildVersion | out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Solutions in Farm"
 Get-SPSolution | select Displayname, deployed, DeployedWebApplications | out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Site Collections by DB"
 Get-SPContentDatabase | %{Write-Output "`nDatabase: $($_.Name)"; ForEach($site in $_.sites){write-Output ("`t " + $site.url)}}| out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Database sizes"
 Get-SPDatabase |Sort Name| select Name, @{Label = "DB Size in MB"; Expression = {"{0:N2} MB" -f ($_.DiskSizeRequired/1048576)}}, Type, Id | out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "SiteCollection size estimates (very rough)"
 Get-SPSite | Select URL, @{Label="Storage"; Expression={"{0:N2} MB" -f ($_.Usage.Storage/1048576)}} | out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "AAM Info"
 Get-SPAlternateURL
 write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Features in Farm"
 Get-SPFeature -Limit all | out-string -width 200
write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Templates in Farm"
Get-SPWebTemplate | out-string -width 200
 write-output ""
 write-output "--------------------------------------------------------------------------------------------------------"
 write-output "Template USED in farm by web" " "
Write-Host -foregroundcolor yellow "The final step in this script will list every web (site or subsite)
 in your farm along with the template used by that web.
If you have a large number of sites it might take some time to complete and use a lot of resources.
All the other information collected by this script has already been placed in a file,
 so if you answer no, only this step will be skipped."
$continue = Read-Host "Would you like to continue? (Y/N)"
 if($continue -eq "Y")
 {
 get-spsite -limit all | get-spweb -limit all |select URL, @{Label = "Template"; Expression = { $_.WebTemplate}}, @{Label = "TemplateID"; Expression = { $_.WebTemplateID}} | out-string -width 200
 }

		
Advertisements