I will answer my own question as I'm sure others will run into this issue with their schedule tasks.
http://professionalvmware.com/2009/...l-storage/ To create the credcential file run this:
New-VICredentialStoreItem -host 'servername.com' -user 'domain\fredsmith' -password 'blahblah1' -file \\servername\sharename\Credfile.xml
To view the credentials in the credentials file run this:
$creds = Get-VICredentialStoreItem -file "\\servername\sharename\Credfile.xml"
$creds | fl *
To use the credentials run this:
$creds = Get-VICredentialStoreItem -file "\\servername\sharename\Credfile.xml"
Connect-viserver -Server $creds.Host -User $creds.User -Password $creds.Password
You can put multiple credentials in the same encrypted credential file. To connect to each server in a multi credential file run this:
ForEach ($creds in $credentials) {
Connect-viserver -Server $creds.Host -User $creds.User -Password $creds.Password
# Do other stuff here...
}
Enjoy - Richard