Powershell script logon to Multiple vCenter Servers not working in Windows Server 2012R2 scheduled task.


First time on here so let me know if there is another forum I should be asking this question to.

I have a powershell script to collect datastore information from Multiple vCenter servers (2012r2 and 2008R2). I need this script to run as a scheduled task. The following is general information that may help in answering my question/fixing my problem.

The script gathers the datastore information and outputs it to HTML and emails the HTML to a group of system admins.

1. When I run the script from an elevated powershell command prompt it works perfectly.

2. When I run the script from the Task Scheduler (manually) it runs perfectly.

3. After I logout of the server and the task runs from the task scheduler it fails to login to the vCenters and collect the datastore information.

I am using a credential file (created using Get-Credential - Export-Clixml - and Import-Clixml) which works for 1 and 2 above.

How do I get the authentication working for # 3 above, or is there an entirely different method I should be using?



0 Kudos
0 Replies