#check status of the solution: installation, deployment # based on # solution ID "SolutionId" value="77a1b7f6-d62c-4566-8f2f-de99fcdd351e" # feature id: 9efcdcab-7ad4-4195-9d67-cd2a91efe5e1 # 9efcdcab-7ad4-4195-9d67-cd2a91efe5e1 function Get-Feature-Activation-Status([string]$fdId){ #from http://blog.falchionconsulting.com/index.php/2011/04/retrieving-sharepoint-2010-feature-activations-using-windows-powershell/ $fd = Get-SPFeature -Identity $fdId Write-Host "Activation status:" $activated = $false switch ($fd.Scope) { "Farm" { #[Microsoft.SharePoint.Administration.SPWebService]::AdministrationService.QueryFeatures($fd.ID) $timeactivated = AdministrationService.QueryFeatures($fd.Id).TimeActivated if($timeactivated -ne "") { Write-Host "Farm | Activated (on $($timeactivated))!" $activated = $true } else { Write-Host "Farm | NOT Activated!" } break } "WebApplication" { #[Microsoft.SharePoint.Administration.SPWebService]::QueryFeaturesInAllWebServices($fd.ID, $false) $timeactivated = QueryFeaturesInAllWebServices($fd.Id).TimeActivated if($timeactivated -ne "") { Write-Host "WebApplication | Activated (on $($timeactivated))!" $activated = $true } else { Write-Host "WebApplication | NOT Activated!" } break } "Site" { foreach ($webApp in Get-SPWebApplication) { $timeactivated = $webApp.QueryFeatures($fd.Id).TimeActivated if($timeactivated -ne "") { Write-Host "Site: $($webApp) | Activated (on $($timeactivated))!" $activated = $true } else { Write-Host "Site: $($webApp) | NOT Activated!" } } break } "Web" { foreach ($site in Get-SPSite -Limit All) { $timeactivated = $site.QueryFeatures($fd.Id).TimeActivated if($timeactivated -ne "") { Write-Host "Web: $($site) | Activated (on $($timeactivated))!" $activated = $true } else { Write-Host "Web: $($site) | NOT Activated!" } } break } } return $activated } $solutionId = "77a1b7f6-d62c-4566-8f2f-de99fcdd351e" $featureId = "9efcdcab-7ad4-4195-9d67-cd2a91efe5e1" Write-Host "Get information about solution Id: $solutionId" Write-Host "-------------------------------------------------------------" Add-PSSnapIn Microsoft.SharePoint.PowerShell $SemanticSearchWebparts_solution = Get-SPSolution | ? {$_.Id -eq $solutionId} $solution_present = $false $solution_deployed = $false $deployment_job_present = $false $feature_present = $false $feature_activated = $false Write-Host "A. Solution:" if ($SemanticSearchWebparts_solution) { $solution_present = $true Write-Host "-Name: $($SemanticSearchWebparts_solution.Name)" Write-Host "-Id: $($SemanticSearchWebparts_solution.Id)" Write-Host "-Status: $($SemanticSearchWebparts_solution.Status)" if ($SemanticSearchWebparts_solution.JobExists -eq $true){ Write-Host Write-Host "There is a retraction job pending with status: $($SemanticSearchWebparts_solution.JobStatus)" $deployment_job_present = $true } if ($SemanticSearchWebparts_solution.DeploymentState -ne "NotDeployed"){ Write-Host Write-Host "The solution is deployed (DeploymentState is $($SemanticSearchWebparts_solution.DeploymentState))." Write-Host "LastOperationDetails: $($SemanticSearchWebparts_solution.LastOperationDetails)" Write-Host "DeployedServers: $($SemanticSearchWebparts_solution.DeployedServers)" $solution_deployed = $true } else { Write-Host "The solution is not deployed (DeploymentState is $($SemanticSearchWebparts_solution.DeploymentState))." Write-Host "LastOperationDetails: $($SemanticSearchWebparts_solution.LastOperationDetails)" } Write-Host Write-Host "B. Features that point to the solution:" foreach ($grp in Get-SPFeature -ErrorAction "Continue" | where {$_.SolutionID -eq $SemanticSearchWebparts_solution.Id} | Group-Object SolutionId) { foreach ($fd in $grp.Group | sort DisplayName ) { if($fd) { Write-Host $fd.DisplayName '-' $fd.Id '(Scope: ' $fd.Scope ')' $(Get-Feature-Activation-Status($fd.Id)) } } Write-Host } } else { Write-Host "The solution with Id $($solutionId) is not present." } Write-Host "C. Feature that is deployed by the installer (Id: $featureId):" $fd = Get-SPFeature -Identity $featureId if ($fd) { $feature_present = $true Write-Host $fd.DisplayName '-' $fd.Id '(Scope: ' $fd.Scope ')' $feature_activated = Get-Feature-Activation-Status($fd.Id) } else { Write-Host "The feature with Id $($featureId) is not present." } Write-Host Write-Host "Conclusion:" Write-Host "-----------" Write-Host ("solution is present: $($solution_present).") Write-Host ("deployment job is present: $($deployment_job_present).") Write-Host ("feature is present: $($feature_present).") Write-Host ("feature is activated: $($feature_activated).")