我需要从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