4

I'm trying to create a UPS sync connection using powershell. Becuase of the vagaries of our AD setup I can't use the Central Admin 'Create New Connection' function.

I am using the script below which is copied directly from the technet article on the AddSPProfileSyncConnection command and modified with our deployments data.

Add-SPProfileSyncConnection -ProfileServiceApplication 3b0a7b01-d954-4120-90b5-caa9382ebd9a -ConnectionDomain MyNETBIOS  -ConnectionForestName My.Forest.Name -ConnectionPassword convertto-securestring "Password" -asplaintext -force -ConnectionSynchronizationOU TopOU -ConnectionUserName Domain\svc_spdev_pfl -ConnectionPort 389   

When I run the script I get an error message:

Cannot bind parameter 'ConnectionPassword' Cannot convert the "convertto-securestring" value of type "System.String" to type "System.Security.SecureString".

What have I done wrong?

1
  • Try this on your password string $PlainPassword = "P@ssw0rd" $SecurePassword = $PlainPassword | ConvertTo-SecureString -AsPlainText -Force
    – Aanchal
    Commented Jul 16, 2014 at 8:55

1 Answer 1

8

convert the password into a varible that you can pass:

$secureString = convertto-securestring "Password" -asplaintext -force

now just use that converted secure string:

Add-SPProfileSyncConnection -ProfileServiceApplication 3b0a7b01-d954-4120-90b5-caa9382ebd9a -ConnectionDomain MyNETBIOS  -ConnectionForestName My.Forest.Name -ConnectionPassword $secureString -ConnectionSynchronizationOU TopOU -ConnectionUserName Domain\svc_spdev_pfl -ConnectionPort 389  
1
  • 1
    no probs happy to hellp!
    – Ali Jafer
    Commented Jul 16, 2014 at 10:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.