I want to give a Domain User SharePoint permissions on a Site. The peoplepicker in SharePoint found the user and i can add the user in the Browser to the Site. But when I use PowerShell, the User is not in the permission list on the SharePoint GUI.
PS: New-SPUser -UserAlias "test\TestUser2" -PermissionLevel Contribute -web http://test.sharepoint.de/site/page
PS:
UserLogin 开发者_JAVA技巧 DisplayName
--------- -----------
TEST\testuser2 TestUser2
also not working:
Get-SPWeb "http://test.sharepoint.de/site/page" | New-SPUser –UserAlias "test\TestUser2" -PermissionLevel Contribute
It should be this: Set-SPUser -Identity 'domain\name' -Web http://sp2test/site -AddPermissionLevel Read
What happens if you drop the page from your command?
New-SPUser -UserAlias "test\TestUser2" -PermissionLevel Contribute -web http://test.sharepoint.de/site
Also, after you add them through the GUI, does your command work to add them to additional sites? Also, dumb question maybe, but are you running PS as a user who has access to add people to the site?
Try adding Add-PSSnapin "Microsoft.SharePoint.PowerShell" It worked for me
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
Set-SPUser -Identity 'domain\name' -Web http://sp2test/site -AddPermissionLevel Read
精彩评论