No announcement yet.

schedule New-MoveRequest

  • Filter
  • Time
  • Show
Clear All
new posts

  • schedule New-MoveRequest

    Exchange 2003 SP2 source > Exchange 2010 SP1 target. (InterOrg)

    Any of you PowerShell guru's know of the correct syntax required to parse credentials into the get-credential command so that i can run this on a schedule?

    It appears that the underlying security sub system of PS doesn't seem to allow parsing clear text passwords. Parsing the user name though is easy. But im having difficulty parsing the "password" as this is required for the local and remote host in order for the cross forest mail box migration to take place.

    I can create a password file with the following $password = get-content C:/passwordfile.txt | convertto-securestring. But im having difficulty piping that into the relavent place so the PS Shell opens with the right credentials and then runs my desired script? Any ideas?
    Last edited by scurlaruntings; 21st April 2011, 17:05.

  • #2
    Re: schedule New-MoveRequest

    Update: Thanks to Ed Crowley MVP.

    $User = "domain\username"

    $PW = ConvertTo-SecureString "password" -AsPlainText -Force

    $RemoteCredentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User,$PW

    $User = "domain\username"

    $PW = ConvertTo-SecureString "password" -AsPlainText -Force

    $LocalCredentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User,$PW

    The above works fine without PS prompting for credentials to be entered. Note the password is in clear text within your script so you would either need to parse this from a secure string or ensure your script is in a secure location.