使用PowerShell得到SharePoint的Application Pool

使用命令Get-SPServiceApplicationPool得到Services所使用的Application Pool

举例:

PS C:\Users\administrator.VSAT> $svcpools=get-spserviceapplicationpool
PS C:\Users\administrator.VSAT> $pool1=$svcpools|?{$_.name -eq "SharePoint Services App Pool"}
PS C:\Users\administrator.VSAT> $pool1

Name                                     ProcessAccountName
----                                     ------------------
SharePoint Services App Pool             VSAT\administrator

 

注意, 下面是使用foreach的方法来得到某个指定的application pool. Foreach命令明显没有pipeline的写法简单哦.

PS C:\Users\administrator.VSAT> foreach($svcpool in $svcpools) {if($svcpool.Name -eq "SharePoint Services App Pool") {$pool2=$svcpool} }
PS C:\Users\administrator.VSAT> $pool2

Name                                     ProcessAccountName
----                                     ------------------
SharePoint Services App Pool             VSAT\administrator

使用如下的命令来得到所有web application使用的application pool

PS C:\Users\administrator.VSAT> $pools = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.ApplicationPools
PS C:\Users\administrator.VSAT> $pool3=$pools | where {$_.Name -eq "SharePoint Hosting Pool"}

注意, SharePoint Services所使用的App Pool在IIS中并不显示名字, 显示的是它对应的GUID.

下面的命令可以帮助你将ID和名字对应起来.

PS C:\Users\administrator.VSAT> $svcpools=get-spserviceapplicationpool

PS C:\Users\administrator.VSAT> foreach($svcpool in $svcpools) {$svcpool.id.tostring() + " "+ $svcpool.name}
0ac86057-a06f-4156-b388-62540d6a4769     FASTSearchAdminServiceAppPool
c334555a-9e7b-469d-bdee-a4a40e831015  FASTSearchQueryAndSettingsAppPool
69693b39-2a7e-4931-b1bc-3e20bd2e3c3b  SecurityTokenServiceApplicationPool
9c03d8ea-0fa5-4850-9b76-b4e1018350ca    SharePoint Services App Pool
881b143d-cea5-4d2c-a319-ddb2ebf19de4  SharePoint Web Services System
PS C:\Users\administrator.VSAT>

 

image

 

参考资料

=================

Automating Microsoft SharePoint 2010 with Windows PowerShell 2.0 (book excerpt)

http://technet.microsoft.com/en-us/library/hh393957.aspx

Get-SPServiceApplicationPool

http://technet.microsoft.com/en-us/library/ff607544.aspx

posted on 2012-01-24 15:29  中道学友  阅读(640)  评论(0编辑  收藏  举报

导航

技术追求准确,态度积极向上