Running a PowerCLI Scheduled task

There are a fair few PowerCLI scripts which can be run as scheduled tasks, some that email you or maybe a monitoring script but recently I have been asked how this can be done, what do you put in the Run line for the script to work properly.

There are two ways of doing this really:

1.  Add a line to a start of each of your scripts to make sure it loads the PowerCLI snapin, without which PowerShell will not recognise any of the PowerCLI cmdlets.

Add the following line to the top of each script you will be running as a scheduled task:

add-pssnapin VMware.VimAutomation.Core

Then in the run box on your scheduled task you can call your script with the following command:

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe “& ‘C:\Scripts\MyScript.ps1′”

But remember when you are troubleshooting this script or amending it you will most likely get an error as your script editor will automatically add the VMware snapin.

2.  This method is the one I use as its easier than remembering to put the line at the top of each file and then commenting it out when you want to edit it etc, this method runs the PowerCLI Console file before it runs your script.

A PowerShell Console file is a xml like file containing information on what snapins to load when PowerShell is started.

This will enable the snapin for you and there is nothing to ad to the scripts.

The run command then looks like this:

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″ ” &  “C:\Scripts\MyScript.ps1”

You can test both of these methods by running them from a cmd prompt before using it to ensure they work properly.

86 thoughts on “Running a PowerCLI Scheduled task

  1. Pingback: Auto-unmount Veeam vPower NFS datastore – Virtual Bits & Bytes

  2. Alexon Oliveira

    Hey, Alan. Just a comment: Sorry if dup (I didn’t read all the other comments), but starting with PowerCLI 6.5 the “add-pssnapin” doesn’t work anymore. Instead we have to use “Import-Module”. I had to make this change in some scripts to work properly with the 6.5 version.

  3. Steve Furniss

    How do you run this in a vsphere 6.5 environment?… I’ve noticed that PowerCLI 6.5 has a different path and does not now use a PSConsole file to start?

  4. J Hicks (@kungfoochef)

    For those struggling with syntax, having the shell window close (likely due to error), etc… Make sure you *manually* type in the command into your Task rather than cut and paste one of the many options provided.

    In many instances, the text encoding in the browser is not compatible with Task Scheduler (or a command window). Normally, it’s the quotation marks — at a minimum, retype those and hopefully things will work for you.

  5. MBhatti

    Hi Guys,

    What a great script but I am unable to run it automatically using schedule task. Has any one cracked it up to now. I have tried pretty much all above solutions and none of them worked for me.

    I am trying to schedule it on 2008 R2 for vCenter 5.0.

    Regards
    Umar

  6. Spencer Alessi

    Run powershell as Admin and then Set-ExecutionPolicy [whatever you want]

  7. Nick Lam

    Thanks Alan sharing the vCheck script. It is an excellent job!
    Hi Orims, try this out: Nick

    Type this in PowerCLI:

    $cred=Get-Credential
    $cred.Password | ConvertFrom-Securestring
    $cred.Password | ConvertFrom-Securestring | Set-Content C:\vSphere\scripts\powerclicred

    In your script, add this:
    • $pwd = Get-Content c:\vSphere\scripts\powerclicred | ConvertTo-SecureString
    • $cred = New-Object System.Management.Automation.PsCredential “home\domain_user“, $pwd

  8. Luca

    I’m a powershell newby so the general confusion of exactly what syntax actually works was quite confusing??

    after trying at least 15 different options the easiest one work on W2K8R2

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -psconsolefile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -file “C:\vCheck\vCheck-vSphere-master\vCheck.ps1”

    it could not have been easier??

    Luca

  9. Pingback: Running a PowerCLI via a Windows Scheduled Task « Technology Tidbits...

  10. Pingback: How-To: Delete a VM via a PowerCLI Scheduled Task | All about virtualization

  11. Pingback: Banish Lingering Snapshots | VirtAdmin

  12. Mantux

    My script runs if I manually run it from powercli. But it does not execute when running as a scheduled task.

  13. paulcrane

    This worked for me 2008R2

    Program\Script:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

    Add arguments (optional):
    -psc “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -noe -c “.\”C:\vcheck\vcheck.ps1\””

  14. Rajesh

    Thsi is not working , only powershell is running , vsphere cli not working also my script not workling

  15. Jimbob

    Here’s the working version for 2012*

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -psconsolefile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -noexit -command c:\myscript.ps1

    If you’re on a 32-bit system, try this:

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -psconsolefile “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -noexit -command c:\myscript.ps1

  16. Pingback: Running a PowerCLI via a Windows Scheduled Task | rabt2000

  17. Brandon

    For some reason this command works when I run it from a command prompt, but doesn’t seem to start the script (I added a line to create a file at the start of my script, and it doesn’t even get to that) when run as a scheduled task. Any ideas why this might be?

  18. Ayanes

    Hey the vcheck script is great with tons of useful information. However when I run this even though I have “set-executionpolicy unrestricted” I am still prompted for each script with the security warning whether I want to run once or not waiting for me to type r to run it, i can use bypass and skip the prompts. But I am trying to schedule this through the task scheduler and it is getting stuck I assume on waiting for the input. I have changed my task to have the following C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe and the following arguments -executionpolicy -bypass -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” “& ‘E:\Scripts\VMWare\vCheck\vCheck.ps1′”. This results in the script saying it ran succesffuly in less than 60 seconds but nothing happens, no email no nothing. Any suggestions how to skip those security warning prompts.

  19. Rhian Cohen

    Ok I actually got this working in Task Scheduler on Windows Server 2008 R2 by doing the following

    Program/script:

    C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe

    Arguments

    -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″ “& ‘C:\vCheck\vCheck.ps1′”

  20. Rhian Cohen

    So out of these possibilities, which are correct for putting in a Windows 2008 R2 Task Scheduler?

    C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″ -noexit “& ‘C:\vCheck\vCheck.ps1′” my-vcenter

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″ “& ‘C:\Scripts\VMDailyReport.ps1′ my-vcenter″

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″ “& ‘C:\Scripts\VMDailyReport.ps1′” my-vcenter

    or

    Program/script: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe

    Arguments: -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″ -command “& c:\vCheck\vcheck5.ps1 vcenterserver”

  21. Pingback: vCheck Script | Electric Monk

  22. Pingback: Scheduled task to run a PowerCLI script (and delete a named snapshot) « VirtuallyMikeBrown

  23. Guy Wilcox

    I’m a beginner powershell/powerCLI user trying to use your suggestion above, and I’m having problems determining what special characters, ticks and others, that you are using within the quotation “& ‘C:\Scripts\MyScript.ps1′”. Can you explain or point me to a document that does.

    Thank-you

  24. Pingback: Monitoring Veeam FLR sessions using PowerCLI | Virtual Bits & Bytes

  25. 8i5

    Great script!
    I may have found a minor typo on lines 385 and 387:

    The variable $VISRV should be $VIServer if you want the name of the vCenter server to show up in the subject line of the email.

  26. Sybux

    Last thing, replace manualy every ” with one you type in the command line. The Copy/Paste didn’t copy the good one (wp bug ? )

  27. Sybux

    For those like me who are in a bad mood with ” you can also used this syntax :

    powershell.exe -PSConsoleFile “%ProgramFiles(x86)%\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -File “C:\vCheck6\vCheck.ps1”

  28. Pingback: vCheck 6.0 released | | Virtu-Al.NetVirtu-Al.Net

  29. Alan Post author

    The view snapin is called VMware.View.Broker so i would add something like this to the start of your script:

    if (!(get-pssnapin -name VMware.View.Broker -erroraction silentlycontinue)) {
    add-pssnapin VMware.View.Broker
    }

  30. Steve

    Hi,
    I was wondering how I would run a VIEW PowerCLI script as a scheduled task?
    I do not have the VMware PowerCLI installed on my connection server, just the View PowerCLI, so ‘VMware.VimAutomation.Core’ is not available. Any ideas?

    Cheers,
    Steve

  31. vSoluationArchitect

    vCheck worked right away.

    The surprise was it find ‘exceptions’ and reports on them. I used it recently as we built a lab prior to a mgiration to later version of vSphere. It was helpful to monitor both production and lab with script (aimed at the different vCenters).

    It was easy to adjust limits (such as number of VMs per LUN up from 5 (default), etc).

    Nice job.

    Larry T.

  32. Nigel Snow

    Trouble running as scheduled task resolved.

    I have been playing with this exceptionally helpful script for a few days as I was having trouble triggering it via a scheduled task in Windows 2008R2 and noticed others also had problems.

    I needed to change the line in the script that set the appdata environment variable from “C:\Documents and Settings\” + $USER + “\Application Data” to “C:\Users\” + $USER + “\AppData\Roaming”, I also hardcoded the cred file path to $CredFile = “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\mycred.crd” once created and tested.

    The correct syntax is throughout the posts above.
    Cheers

  33. Dean

    Hello,
    Awesome vCheck script! Saves me so much time it is amazing. I do have one issue that maybe you have seen. When the html comes out to IE it looks perfect but when it sends to my email (outlook 2010) the secondary titles and descriptions and any background colors are lost. Is there anything I can do to clean up the look of the email output to match the IE output?

    Thanks again for an awesome script.

    Dean

  34. Matt

    I read all the comments and could not get this to execute on my Win7 x64 PC. I downloaded System Scheduler free, put the commands into a .bat file and it executed with no issue.

  35. Eric

    Note on a 64bit server the path to vim.psc1 is different it should be “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1”

  36. Guido

    this is all is says.
    [vSphere PowerCLI] C:\> cd scripts
    [vSphere PowerCLI] C:\scripts> cd test
    [vSphere PowerCLI] C:\scripts\test> .\vcheck5.ps1
    2:41:06 PM Connecting to VI Server
    [vSphere PowerCLI] C:\scripts\test>

  37. Gerard Delgado

    Try to run the task from a PowerCLI prompt and see what you get. Make sure the account you specified when creating the XML encrypted file has rights to log onto VCenter.

  38. Guido

    i’ve comment out that line, started the scheduled task, a command box is opened and i see
    8:09:03 AM Connecting to VI Server
    PS C:\WINDOWS\system32\WindowsPowerShell\v1.0>

    and nothing happens

  39. Nick

    I am experiencing an interesting problem … I run the script, it connects, gathers the information, gets to “Displaying the HTML Results” … and … nothing.

    I get no browser display … nothing in the event logs, I cannot see any processes that have started after the script (iexplore.exe for example).

    Anyone seen this before?

  40. Gerard Delgado

    Comment out param line which is at the very top of the script. If you do that and run the script what error do you get?

  41. Gerard Delgado

    Guido,

    Add the below to the very top of your script.Also please ensure your running the script with the same account you used to create the XML.

    add-pssnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue

  42. Guido

    I have tried the document you’ve made. made the xml file edited the vcheck5 file.
    But i still get the error that is above.
    The term ‘param’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
    try again.
    At C:\scripts\test\vCheck5.ps1:3 char:6
    + param <<<< ( [string] $VISRV)
    + CategoryInfo : ObjectNotFound: (param:String) [], CommandNotFoundException

  43. Gerard Delgado

    I have created a document to schedule this script as a tasks and also to store your credentials in an encrypted XML file. Please see the link below I hope this helps anyone encountering the same issues I had.

    http://cl.ly/3L3b3T1a1p3n1p382h3q

  44. Guido

    I get this error all the time, i run the script from powercli:

    The term ‘param’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
    try again.
    At C:\scripts\test\vCheck5.ps1:7 char:6
    + param <<<< ( [string] $VISRV)
    + CategoryInfo : ObjectNotFound: (param:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

  45. Chad King

    well I guess I could just run it as a batch file and pass the user id information into the script and run that as a scheduled task… not my perferred method but I think it would work – a batch file for each environment would prob work. Sorry for the double post Alan.

  46. Chad King

    Hey Alan,
    Been busy day for me here at the office but I have been trying to figure out how to get this done. Here is a summary of what I am trying to accomplish.

    1.I have 9 vCenters and they all require different credentials. Where or how can I store these credentials and call them to run the script as a scheduled task. < forgive my ignorance 😉

    2. I dont need SMTP or anything like that I just want it to create HTML reports. I tried finding the path that it dumps the file in but have failed. I also use Powergui not sure if that will help with anything.

    I will more than likely run the scheduled task from my desktop since it has full access to all the different virutal environments over a vpn.

    I tried following the details in the script about a credential store and specifying a user name but that doesnt seem to work…

    Thanks,
    Chad King

  47. Oliver

    I got the script to work with Win2008 R2 task scheduler by setting up the task as follows:

    Program/script: powershell.exe
    (i suggest to extend the path variable with %SystemRoot%\system32\WindowsPowerShell\v1.0\)

    Arguments: -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -command “& c:\scripts\vcheck5.ps1 vcenterserver”

    Regards

  48. Kevin Lengel

    Hey guys,

    For the Windows 7 (64-bit) users, I finally found the syntax in order to run your scripts. Here it is:

    Program/script textbox:
    C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe

    Add arguments textbox:
    -psc “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -command “C:\YourScript.ps1”

    deercutter, I hope you find this useful! I know I am relieved! I will be posting this on my blog (wasupbe.com)

  49. Pingback: vTip – A VMware Expert updating your VI « Virtu-Al

  50. Pingback: PowerCLI: Daily Report « Virtu-Al

  51. deercutter

    If I issue each command seperately, the script runs. But If I run the script together, it never gets by the first line:

    powershell.exe
    Add-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue
    C:\PSscript\vCheck521.ps1 vi_server

    I had no problem runniing this script from a Windows XP workstation. Now I have a Windows 7 (64-bit) workstation.

    Any advice would be appreciated.

    Note* This was my previous script on a Windows XP workstation:

    %SystemRoot%\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -command “”

    Here is the error message it returns:

    Failed to load Windows PowerShell console file “C:\Program Files\VMware\Infrastr
    ucture\vSphere PowerCLI\vim.psc1”. WIN 32 error: The system cannot find the path
    specified.

  52. tien lam nguyen

    I also have the same problem as Nicolas.
    here are my windows 2008 schedule task settings:
    Program/script:
    powershell.exe
    Add arguments (optional):
    -noninteractive -noprofile -command “(ampersand) (open braket)C:\Scripts\vcheck\vcheck.ps1 vcenter1(closing braket)”

    Added the Vmware snapin at the begining of the script.

    The script runs but never ends enven after 24 hours.
    Interesting enough if I run the same command in a windows prompt It will complete without any issues

  53. Pingback: thattommyhall.com » Playing with PowerShell

  54. Pingback: Protecting your Virtual Machines From “That Guy”

  55. Nicholas

    This does not work on Server 2008 R2. I put the entire command in a PS script and then use the scheduled task to call the script to run. It runs, however never terminates or completes.

  56. Jon H

    Hello I was trying to get this script to run as a Task in Windows and have been having some issues. Here is what I am using:

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″ -noexit “& ‘C:\VMScripts\vCheck5.ps1′” DITSFAVC01

  57. Burak


    Daren:

    I found on Windows 2008 R2 simply entering the following in the two fields fixed it for me.
    Program/script:
    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe
    Add arguments (optional):
    C:\Scripts\MyScript.ps1
    Note: removing the & (ambersand) with also removing the speak marks from the script posted above
    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe “& ‘C:\Scripts\MyScript.ps1′”

    This has also worked for me. I added “add-pssnapin VMware.VimAutomation.Core” on the first line of my script.

  58. Enone

    Hey, great script!
    But I got one problem: When I run the script vom cmd-line everything is fine, I passed the connection Info like written in “Adjusting connection information”, so no user-request here.
    When I run the command as a scheduled task, I get asked for user and password. If I’m logged into the running user, I can click “cancel” multiple times and get a report at the end. But of course the user normally isn’t logged in and the script won’t go on without interaction.

    Any solution?

    Greetings

  59. Rusty

    Please disregard my last post. I have successfully run the script interactively thank you now to set it up as a scheduled task.

  60. Rusty

    Hi, Thanks fro this script bit I cannot get it to work. I am actually trying this on ESX 3.5 VC 2.5 U2 and in your example you have the command line …“C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″

    I actually don’t have that file (vim.psc1) in that path, or any other path for that matter. I do have the vSphere RCLI components installed, powershell installed, and .NET installed. So it would appear I have all the dependencies. On a brighter note the email component does work as I am receiving error emails.

    So if someone could kindly steer me in the right direction I would appreciate it.

  61. Mike

    I could not get it to run while logged out until I put it in a .cmd. So now I have a SchedTask calling vCheck.cmd, which contains:
    C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” “& ‘E:\vCheck\vCheck5.ps1′” my-vcenter

  62. Mike

    After many attempts, realized that -noexit need to be after -PSConsoleFile

    C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1” -noexit “& ‘E:\vCheck\vCheck5.ps1′” my-vcenter

  63. Eugene

    Hi and Thanks again for doing all this work. I finally got it running the way I want it.

    Here is a correction to post #5, you had the vcenter server inside the quotes and it wasn’t working. It should work with this syntax:

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1″ “& ‘C:\Scripts\VMDailyReport.ps1′” TESTVC01

  64. Daren

    I found on Windows 2008 R2 simply entering the following in the two fields fixed it for me.

    Program/script:
    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe

    Add arguments (optional):
    C:\Scripts\MyScript.ps1

    Note: removing the & (ambersand) with also removing the speak marks from the script posted above

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe “& ‘C:\Scripts\MyScript.ps1′”

  65. Krobe

    You can just add the line to your script and avoid the error:

    Add-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue

    I personally find this way easier.

  66. Pingback: Powershell Scipt for VMware View / vSphere, Who is logged into which VM? « Virtualised Reality

  67. Pingback: PowerCLI: Document the ESX Hostname of the vCenter VM « ICT-Freak.nl

  68. Steve Chung

    Hi
    just to let you know that the following script doesn’t run, could you please help my give more clear instruction as how to make it work.

    I tried to run this script from vSphere PowerCLI on my desktop. and I simply replace MyScript.ps1 with my own script called “DailyReport.ps1”. I got error, could you please help.

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1″ ” & “C:\Scripts\MyScript.ps1″

    thanks

    hope to hear from you soon.

    Best Regards,

    Steve Chung

  69. Virtu-Al

    @Chrisfoo
    Hi, the above cmd line is to be used in a scheduled task window, if you are trying to run this from the powershell prompt then you can just CD into the folder and do:

    .\DailyReport.ps1 YOURVISERVER

    As you have custom connection ports and credentials you will need to edit the script manualy and find the line which does a connect-viserver and adjust it to work as specified in your comment.

    Hope this helps.

  70. Chrisfoo

    Hi There, I am new to powershell and having a few issues with getting this DailyReport to work the ways that have been mentioned in sch tasks and command prompts,
    Our Vcenter uses a different Port
    1. I have to first do this: Proxy stops Connection: Set-VIToolkitConfiguration -ProxyPolicy NoProxy

    I can then connect with this: Connect-viserver -server vcenter server-Port 1443 -Credential (Get-Credential servername\administrator) (THIS CONNECTION WORKS)

    But if i try and run the suggestions at the thread above i get this
    [VI Toolkit] C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> C:\WIND
    OWS\systems32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\ProgramFi
    les\VMware\Infrastructure\VIToolkitForWindows\vim.psc1” “& ‘C:\Scripts\DailyRepo
    rt.ps1 vcenterserver -Port 1443”
    The term ‘C:\WINDOWS\systems32\windowspowershell\v1.0\powershell.exe’ is not re
    cognized as a cmdlet, function, operable program, or script file. Verify the te
    rm and try again.
    At line:1 char:59

    I can VI connect using Ecoshell gui to vcenter also, but how do you run the DailyReport from there?

    Any help would be much appreciated as i would like to be able to manage vcenter with Powershell

  71. Pingback: Scheduling VMware’s FT (Fault Tolerance)

  72. slimboyfat

    @Virtu-Al

    That seems to have sorted it – although I already had the VMWare stuff loaded (it “complains” if I run it interactively) but I’m not goiing to worry!

    The script is excellent – thanks for all your help!!

    Jack

  73. Virtu-Al

    @slimboyfat
    Ok, Try this:

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile “C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1″ “& ‘C:\Scripts\VMDailyReport.ps1′ TESTVC01″

  74. Virtu-Al

    @slimboyfat
    Funny enough I had someone with the same issue today, if you put the command in the run window of the scheduled task it should be fine.

  75. slimboyfat

    Maybe I’m missing something, but scheduling doesn’t seem to work?

    I’ve created a batchfile as follows:

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -command “& ‘C:\Scripts\VMDailyReport.ps1’ VI-ServerName”

    If I run it interactively, it’s fine and I get the report – but if I try to schedule it, no report arrives….

    Any suggestions??

  76. Pingback: Episode 77 – Edward Haletky Talks About VMware « PowerScripting Podcast

Leave a Reply

Your email address will not be published. Required fields are marked *

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