I am trying to Unlock an AD Account via Invoke Powershell script activity. my process is like
- Ask User for UserID and Store that value in a variable
- Get Credentials From Orchestrator
- Invoke Powershell Script with System Admin Domain account(Only system Admin has access to AD). I am using below script
“$credential = New-Object System.Management.Automation.PsCredential($UserName, (ConvertTo-SecureString $Password -AsPlainText -Force))
Unlock-ADAccount -Identity $UserID -Credential $credential”
I am passing the UserName, Password and UserID variable via PowerShellVariables.
** As you guys know if you use Get Credential activity to get Credentials from Orchestrator it converted the Password data type to SecureString. If I pass the Password variable with SecureString data type then Powershell throws an error. If the data type is String then everything works fine**