VMware Cloud Community
btok
Contributor
Contributor
Jump to solution

Scheduling Powershell / Toolkit

Does anyone have a syntax example for executing a powershell script for vmware utilizing scheduling in XP?

thanks

0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

You can run your script using PowerShell as long as you add the command "add-pssnapin VMware.VimAutomation.Core" at the top of your script. The toolkit environment just loads this snapin, sets a few aliases, and a few other things.

View solution in original post

0 Kudos
6 Replies
ief
Contributor
Contributor
Jump to solution

create a scheduled task with the following syntax

powershell -command "& 'c:\path\test.ps1'

blog www.ivobeerens.nl
btok
Contributor
Contributor
Jump to solution

Thanks for the response

Wouldn't you need to call the vitoolkit instead of powershell?

0 Kudos
admin
Immortal
Immortal
Jump to solution

You can run your script using PowerShell as long as you add the command "add-pssnapin VMware.VimAutomation.Core" at the top of your script. The toolkit environment just loads this snapin, sets a few aliases, and a few other things.

0 Kudos
EXPRESS
Enthusiast
Enthusiast
Jump to solution

Hi All need some assistance I have been trying to ran a Scheduled Task running XP for a PowerShell Script, but i can't get it to go....

1. I start Add Schedule Task

2. I search for the Windows PowerShell program

3. Give the task a name and when to perform the task

4. Place my log in credentials

5. now in the Run: is where I am having problem I dont know what should go there

any advice?

Thank you,

Express

Thank you, Express
0 Kudos
LucD
Leadership
Leadership
Jump to solution

In the Run field you give PowerShell + parameters + script.

Something like this

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" -NoExit -Command "C:\script.ps1"

Have a look at Alan's blog entry on this subject: Running a PowerCLI Scheduled task


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
EXPRESS
Enthusiast
Enthusiast
Jump to solution

Thanks for the infor I finally got it to work last night at about 2am. Just about everything you have except for the (VIToolkitForWindows\vim.psc1) since I did not install that.

Thanks.

Thank you,

Express

Thank you, Express
0 Kudos