Update: Schedule a VI Toolkit script


image image

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.

Advertisements

2 thoughts on “Update: Schedule a VI Toolkit script

  1. LucD

    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.

    Reply
  2. Rob Mokkink

    I spoken to Carter Shanklin on this subject during Vmworld, and i also emailed him. They will fix it for the next release.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s