• This topic has 1 reply, 2 voices, and was last updated April 25, 2017 by Wes C.

Unable to run PS script

  • Hello.
    I’m fairly new into powershell scripting so I hope I got everything right. Currently testing on Zerto 5.0 U1.
    Colleges asked me if Zerto has some option that would enable us to change resources on replicated machines when testing or doing failover.
    After some reading I found nothing and started creating a script that would run after a machine is created on failover site, turn down the virtual machine, change cpu and memory setting and then turn on the machine. I’ve also created a batch script that takes %ZertoOperation% and runs powershell script based on test or failover scenario.
    First thing that script does is imports VMware.VimAutomation.Core so it could take commands such as Connect-VIServer and get-vm.
    Script runs normally when started within Windows, changes VM resources and start VM back on, but when I want it to start as post-recovery script and read log and find – “Import-Module : The specified module ‘VMware.VimAutomation.Core’ was not loaded because no valid module file was found in any module directory.”

    Some help or advice would be appreciated.

    Hi Darko,

    VMware has just released PowerCLI 6.5.1 which is now available to be installed from the PowerShell Gallery. If you follow the instructions at the link below, you will no longer need to call the “Import-Module” command in your script. Just be sure to install the VMware.PowerCLI module in an Administrator PowerShell session on the ZVM so that all users gain access to the installed module. You will have to do this on each ZVM you intend to run this script.

    Welcome PowerCLI to the PowerShell Gallery – Install Process Updates

    –Wes

You must be logged in to create new topics. Click here to login