Hello,
I am moving my Veeam B&R server and on my old one, I am using the following .BAT script to start/stop VM's for my backup jobs:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -executionpolicy Remotesigned -Command Add-PSSnapin VeeamPSSnapIn; Add-PSSnapin VMware.VimAutomation.Core; Connect-VIServer -Server ESXiHOST -user USERNAME -password PASSWORD; Start-VM -VM "VMNAME" -Server ESXiHOST
However, it gives the following errors:
Add-PSSnapin : The Windows PowerShell snap-in 'VMware.VimAutomation.Core' is not installed on this computer.
Connect-VIServer : The term 'Connect-VIServer' is not recognized as the name of a cmdlet...
Start-VM : The term 'Start-VM' is not recognized as the name of a cmdlet...
Even if I remove Add-PSSnapin VMware.VimAutomation.Core, it doesn't work. I opened a Veeam support ticket but they said the help they could provide is limited.
Please help!
Thanks!
-
- Service Provider
- Posts: 19
- Liked: 3 times
- Joined: Jan 19, 2016 4:51 pm
- Contact:
-
- Veeam Vanguard
- Posts: 282
- Liked: 113 times
- Joined: Apr 20, 2017 4:19 pm
- Full Name: Joe Houghes
- Location: Castle Rock, CO
- Contact:
Re: Start VM and Stop VM script
You need to install PowerCLI on your new server, then you can change the following in your batch file and it should work:
'Add-PSSnapin VMware.VimAutomation.Core' should be updated to 'Import-Module VMware.PowerCLI'.
However, if PowerShell is higher than version 3 on the server then module auto-loading should take care of this, so I'd guess that you do not have PowerCLI installed, or it cannot be found in the PSModule path for some reason.
'Add-PSSnapin VMware.VimAutomation.Core' should be updated to 'Import-Module VMware.PowerCLI'.
However, if PowerShell is higher than version 3 on the server then module auto-loading should take care of this, so I'd guess that you do not have PowerCLI installed, or it cannot be found in the PSModule path for some reason.
Husband, Father, Solutions Architect, Geek | @DenverVMUG & @DenverPSUG leader | International Speaker | Veeam Vanguard | vExpert (PRO) | Cisco Champion
Who is online
Users browsing this forum: Bing [Bot] and 16 guests