2

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'

3
  • 1
    Post the code you use to change user Aug 14, 2013 at 12:55
  • I think your issue is with impersonation, but without knowing the code you use it will be difficult to answer your question, so please edit your question and add the source of the PowerShell script that you use. Aug 14, 2013 at 13:08
  • It's powershell so there's no need to escape \`, like "DOM\\UID" Aug 14, 2013 at 13:43

1 Answer 1

4

The trick is in the backslash, there's no need to escape it in Powershell. I just verified it. Use:

$uid = "DOM\UID"

And it will work

1
  • Muchas gracias! I can/will/am happy to confirm that the double backslash was the problem. I suspect that caching (i.e. me not disposing the created objects after a connection failure) in the PowerScript console lead to some confusion.
    – user348
    Aug 15, 2013 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.