sharepoint服務器中切換用戶帳號


Sharepoint服務器PS Code
Enter-PSSession  //一次執行即可
Enable-WSManCredSSP -Role Server -Force //一次執行即可


Client PS Code
Set-Item wsman:\localhost\Client\TrustedHosts -value 192.168.0.*  //一次執行即可


$mypwd = convertto-securestring "sharepointserverpwd" -asplaintext -force
$mycreds = New-Object System.Management.Automation.PSCredential ("domain\username", $mypwd)
Enter-PSSession  szxwis01-wb -Credential $mycreds -Authentication Credssp


invoke-command -ScriptBlock { D:\test.ps1 } -ComputerName cumputerName -Credential $mycreds -Authentication Credssp


參考文章:http://blogs.msdn.com/b/besidethepoint/archive/2010/05/26/powershell-remoting-for-sharepoint.aspx


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章