I am trying to gather some information from my Hyper-V hosts. I have a whole bunch of them and would like to automate this process. I need to get the Virtual machines that are running on each host. I would like to do this from a batch script. When I run this command in the PowerShell V1.0 window (on the Hyper-V host) it works and gives me the information necessary:
get-vmmemory | select VMelementName,reservation | out-file c:\Output.txt
This is how i am running this from a batch script:
\\<RemoteMachine>\c$\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command get-vmmemory >>aa.txt
This is the output I get
The term 'get-vmmemory' 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 line:1 char:16
+ & {get-vmmemory <<<< }
+ CategoryInfo : ObjectNotFound: (get-vmmemory:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Does anyone have any clue as to why i keep getting this output?
start "" "c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" ....