On the SharePoint Servers:
- In Server Manager, add the user(s) to the following Groups:
- Remote Desktop Users
- WinRMRemoteWMIUsers__
- WSS_ADMIN_WPG
- Run the SharePoint Management Shell as Administrator
- Type Enable-PSRemoting -Force
- Type Enable-WSManCredSSP –Role Server
- Type winrm set winrm/config/winrs '@{MaxShellsPerUser="25"}'
- Type winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="600"}'
- Type Get-SPShellAdmin
- This should only return all the users who have the SharePoint_Shell_Access role
- Type Add-SPShellAdmin -UserName Domain\Username -Database (Get-SPContentDatabase -Identity “ContentDatabaseName”)
- Replace Domain\Username with the user needing access
- Replace ContentDatabaseName with one of the Content Databases
- You will need to run this command for all content databases for the user(s) who need access
- NOTE-> To grant access to all content databases use the following command:Get-SPDatabase | Add-SPShellAdmin DOMAIN\UserName
- Type Get-SPShellAdmin
- The user you added should now be listed
- Type Set-PSSessionConfiguration -Name Microsoft.PowerShell32 –ShowSecurityDescriptorUI
- This will open up a dialog box. Add the user(s) with Read and Execute permissions then click OK
- Run the command again to ensure the permissions were applied correctly
On the Client Machine:
- Open Windows PowerShell as Administrator
- Type Enable-WSManCredSSP -Role client -DelegateComputer “SharePointServerName”
- Replace SharePointServerName with the FQDN of the SharePoint server
- Type $cred=get-Credential
- Type $s=new-PSsession “SharePointServerName” -authentication credssp -credential $cred
- Replace SharePointServerName with the FQDN of the SharePoint server
- NOTE: If this fails with an "access denied" error, re-run Step 10 on the server to enable configuration of the x64 PowerShell by running Set-PSSessionConfiguration -Name Microsoft.PowerShell32 –ShowSecurityDescriptorUI
- Type Invoke-Command -Session $s -ScriptBlock {Add-PSSnapin Microsoft.SharePoint.PowerShell;}
- Type Invoke-Command -Session $s -ScriptBlock {get-SPContentDatabase}
- This will return all the content databases in your SharePoint farm and ensure you have access
- Type Invoke-Command -Session $s -ScriptBlock {get-spserviceinstance}
- This will return the SharePoint service instances and ensure you have access
- Type Enter-PSSession -session $s
You will now see the servers name in [ ] PS: c:\users\someuser\documents
Example: [sp2013-app.fabrikaminc.local]: PS C:\Users\egutierrez\Documents>
At this point, the user can implement PowerShell scripts on the SharePoint server.
Note: Special thanks to Mark Kordelski & Samer Judeh for the assistance with this!
No hay comentarios:
Publicar un comentario