vCheck and storing credentials for scheduled task

This post was originally published on this site

I’m trying to setup vCheck as a scheduled task but it keeps prompting for credentials when running as a batch file.

 

I’ve added the credential using the following command.

 

New-VICredentialStoreItem -Host myvc -User administrator@vsphere.local -Password password – File c:scriptsvcpwd.xml

 

In the connection plugin for vcenter, I’ve added the following lines to pull the credentials but it’s not working. Am I missing further steps here or what is the cause?

 

$Credfile = “C:scriptsvcpwd.xml”

$Creds = Get-VICredentialStoreItem -Host $VIServer -File “C:scriptsvcpwd.xml”

 

The .bat file string is as follows: C:WINDOWSsystem32windowspowershellv1.0powershell.exe -File “C:scriptsvCheck-vSphere-mastervCheck.ps1

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.