Hello All,
I have issue runnig script from my PC, as it seems when i run it locally on the server it works fine, but from my PC i get access is denined error. I'm trying to change DocumentID on a site collection.
I run as domain user which has full control on a web app trough app policy, and is site collection admin (so not issue there).
Here is the code:
cls
$command = {
$s = New-PSSession -ComputerName MYSERVER -Credential DOMAIN\account -Authentication Credssp
Enter-PSSession -Session $s
invoke-command -Session $s -scriptblock {
Add-PSSnapin "Microsoft.SharePoint.Powershell"
$DocIDPrefix = "TEST_DOCID"
$site = Get-SPSite https://mysite/sites/TestSite
[Microsoft.Office.DocumentManagement.DocumentId]::SetDefaultProvider($site)
[Microsoft.Office.DocumentManagement.DocumentId]::EnableAssignment($site, $DocIDPrefix, $true, $true, $true, $false)
}
}
powershell.exe -noexit -Command $command
When i connect using RDP the the server using same credentials and run this it works fine:$DocIDPrefix = "TEST_DOCID" $site = Get-SPSite https://mysite/sites/TestSite [Microsoft.Office.DocumentManagement.DocumentId]::SetDefaultProvider($site) [Microsoft.Office.DocumentManagement.DocumentId]::EnableAssignment($site, $DocIDPrefix, $true, $true, $true, $false)
Any hints?
Kind regards, Dusan Tomic