Guest User

Untitled

a guest
Nov 17th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Add-PSSnapin Microsoft.SharePoint.PowerShell
  2.  
  3. $poolName = 'Service Applications' # leave blank to get all app pools on the server
  4. $serverNames = Get-SPServer | ? { $_.Role -ne "Invalid" } | % { $_.Name }
  5.  
  6. Invoke-Command -ComputerName $serverNames -ScriptBlock {
  7. param
  8. (
  9. [parameter(Mandatory=$false)][string]$PoolName
  10. )
  11.  
  12. Import-Module WebAdministration;
  13.  
  14. foreach( $state in Get-WebAppPoolState -Name $PoolName )
  15. {
  16. [PSCustomObject] @{
  17. Server = $env:COMPUTERNAME
  18. AppPool = $state.ItemXPath.Replace( "/system.applicationHost/applicationPools/add[@name='", "").TrimEnd("']")
  19. Status = $state.Value
  20. }
  21. }
  22. } -ArgumentList $PoolName | SORT Server | FT Server, AppPool, Status -AutoSize
Add Comment
Please, Sign In to add comment