Luc Dekens, better known as LucD, posted a comment on my previous post about scheduling a Powershell script with Scheduled Task in Windows. He pointed me to a fix for a know issue with the VI Toolkit 1.5. Rob Mokkink has posted the following fix on the VMTN forums: http://communities.vmware.com<?xml version="1.0"?>
#FIX FOR TOOLKIT 1.5 $USER = $env:username $APPPATH = "C:\Documents and Settings\" + $USER + "\Application Data" #SET THE APPDATA ENVIRONMENT WHEN NEEDED if ($env:appdata -eq $null -or $env:appdata -eq 0) { $env:appdata = $APPPATH }
The following line(s) are no longer necessary to add in your script:
#FORCE TO LOAD VMWARE POWERSHELL PLUGIN
[Reflection.Assembly]::LoadWithPartialName(”vmware.vim”)
Thanks again Luc for sharing this solution.
Arne, the Add-PSSnapin is still required unless you added that to the profile with which you run the scheduled task.
It’s only “[Reflection.Assembly]::LoadWithPartialName(”vmware.vim”)” that is not required anymore.
Sorry for the confusion.
I spoken to Carter Shanklin on this subject during Vmworld, and i also emailed him. They will fix it for the next release.