Мне нужно установить права доступа к удаленному общему ресурсу из сценария Powershell 4. Я просмотрел эта страница, в частности команда Grant-SmbShareAccess, но этот командлет устанавливает разрешения на локальные общие ресурсы, я бы хотел увидеть параметр -ComputerName
, но, увы, его нет.
Я хочу сделать что-то вроде: 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 работает нормально.
Invoke-Command
это то, что вы ищете. Подробнее здесь - person Matt   schedule 04.09.2014Grant-SmbShareAccess -Name \\MYREMOTESERVER\SHARENAME -AccountName USERACCOUNT -AccessRight Full
- person CitizenRon   schedule 05.09.2014Grant-SmbShareAccess : No MSFT_SMBShare objects found with property 'Name' equal to '\\MYREMOTESERVER\SHARENAME'. Verify the value of the property and retry.
- person Mark Allison   schedule 05.09.2014