Hi all. I wrote a script to do some work but I am having trouble with authentication. Each time it runs it is running under my accout rather than the one specidied in the script.
I have followed this guide so therefore before the below have exported a copy of the scripts user account password (The PSCredentials file)
$PowerCLIUserAccount = "DOMAIN\User $PowerCLIUserPassword = Get-Content PSCredentials | ConvertTo-SecureString $PowerCLICredentials = New-Object System.Management.Automation.PsCredential $PowerCLIUserAccount, $PowerCLIUserPassword Connect-VIServer -Server VCSERVER
At this point though it is connecting but using my account details rather than the one in the script?