I have a PowerShell script that uses the CoreService API. The user which is used to authenticate against the CoreService is a local Admin account. This local account is created on the CM server and used for installation of Tridion.
When I change the user for the CoreService API to my own username, which is an AD domain account, and also a sys admin in Tridion, then the CoreService returns 401 unauthorized.
I am a bit puzzeled why this is and how to change this. Since I would like to run the PowerShell script with my own (domain) account and not with a local account.
I have changed the /webservices folder in IIS Manager to allow/disallow Anonymous Authentication, and allow Windows Authentication. There are other post on StackExchange referring to this 401 issue.
So my question is what needs to be changed on the CM server to allow Tridion users like me to use the CoreService API.
Updated with the source-code:
$tcm = "http://CMS/webservices/coreservice2011.svc"
$uid = "DOM\\UID"
$pwd = "PWD"
$encryptedPass = convertto-securestring $pwd -asplaintext -force
$creds = new-object system.management.automation.pscredential($uid, $encryptedPass)
$client = new-webserviceproxy -uri $tcm -namespace core -class service -credential $creds
Note:
$uid = "CMS\TRI_ADM" is a local account which gets autenticated successfully
$uid = "AD\TRI_ZEN" is a domain account and gets a '401 unauthorized'
\`
, like"DOM\\UID"