$server="R2";
$co = new-object System.Management.ConnectionOptions;
$co.Authentication=[System.Management.AuthenticationLevel]::PacketPrivacy;
$co.EnablePrivileges=$true;
$wmi = [WmiSearcher] "Select * From IIsApplicationPool";
$wmi.Scope.Path = """$server"root"microsoftiisv2";
$wmi.Scope.Options=$co;
foreach($crmpool in $wmi.Get())
{
if($crmpool.name -eq "W3SVC/AppPools/CRMAppPool")
{
$crmpool.recycle();
}
}
如果是部署Workflow Activity,还需要重启MSCRMAsyncService服务,参考下图调用:

6. 部署/注册Plug-in/Workflow Activity之后,现在VPC上运行msvsmon.exe,然后在主机VS里选择"Debug">>"Attach to process...",在Qualifier里填入VPC的信息,比如: WIN2K3\Administrator@R2 ,然后Attach到VPC的w3wp.exe进程(Plug-Ins 调试);或者CrmAsyncService.exe进程(Workflow Activity调试),参考下图:

