我需要從Powershell 4腳本設置遠程共享的共享權限。我查看了this page,特別是命令Grant-SmbShareAccess,但該cmdlet設置了本地共享的權限,我很想看到-ComputerName
參數,但是,唉,沒有一個。如何使用Powershell設置遠程共享的共享權限?
我想做的事情是這樣的:Grant-SmbShareAccess -ComputerName MYREMOTESERVER -Name <share_name> -AccountName <domain_account> -AccessRight Full
如何做到這一點任何想法?我的遠程服務器可能是Windows Server或NetApp vFiler。
編輯
我試過的Invoke-Command
馬特的建議,在與NetApp的vFiler的意見,並得到這個錯誤:
Connecting to remote server MYREMOTESERVER failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".
更改共享的安全性在Windows資源管理器工作正常。
也許'調用,Command'是你在找什麼。更多信息[這裏](http://technet.microsoft.com/en-us/library/hh849719.aspx) – Matt 2014-09-04 12:07:19
@Matt如果我只是處理遠程Windows服務器,我會看看,但如果遠程共享託管在NetApp vFiler上,我認爲這不會起作用,因爲它取決於遠程處理。 – 2014-09-04 12:15:43
您是否嘗試過將服務器名稱與共享名稱一起傳遞?類似於:'Grant-SmbShareAccess -Name \\ MYREMOTESERVER \ SHARENAME -AccountName USERACCOUNT -AccessRight Full' – CitizenRon 2014-09-04 21:27:00