I am trying to create a bat file that opens up the VMware PowerShell prompt and executes a couple of cmdlets. But what I have so far opens up the VMware PS prompt, but then never executes the following cmdlets. Is there any way to force the execution of the cmdlets? I am sure there is, but at a loss for getting it to happen. Any help would be appreciated.
Here is what I have in a bat file as of now. First line stolen from shortcut VMware puts on desktop. I know the second two lines work as I have tested independently from the bat file. The real issue is getting hung after the first line and the second two lines never executing.
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" -NoExit -Command ". \"C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\init.ps1\""
And then after that opens the appropriate prompt, execute the following:
Get-VIServer xxx -User xxx -Password xxx
Add-VMHost -Name xxx -Location (Get-Datacenter -Name xxx) -UserName root -Password xxx
Thanks.