I have the following :-
1.a scanning server which is windows 2012 R2. where I am running the following command to get all the vm inside remote hyper-v servers :-
$vCenterServer = 'Server123';$vCenterAdmin = 'Admin' ;$vCenterPassword = '123' | ConvertTo-SecureString -asPlainText -Force;
$LiveCred = New-Object System.Management.Automation.PSCredential($vCenterAdmin, $vCenterPassword)
Invoke-Command -ComputerName $vCenterServer -Credential $LiveCred {Get-VM}
-
for all the remote hyper-v servers which are 2012 the above command is working well.
-
but I have a remote hyper-v which is windows 2008 R2 , but the above command will be raising this error :-
The term 'Get-VM' 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. + CategoryInfo : ObjectNotFound: (Get-VM:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException + PSComputerName : server123
now I read some articles which mention that I need to import the related hyper-v files when running the command on 2008 R2 servers, so I tried the following:-
$vCenterServer = 'Server123';$vCenterAdmin = 'Admin' ;$vCenterPassword = '123' | ConvertTo-SecureString -asPlainText -Force;
$LiveCred = New-Object System.Management.Automation.PSCredential($vCenterAdmin, $vCenterPassword)
Import-Module 'C:Program FilesmoduleshyperVHyperv.psd1'
Invoke-Command -ComputerName $vCenterServer -Credential $LiveCred {Get-VM}
but I got this error :-
Import-Module : The specified module 'C:Program FilesmoduleshyperVHyperv.psd1' was not loaded because no valid module file was found in any module directory. At line:1 char:1 + Import-Module 'C:Program FilesmoduleshyperVHyperv.psd1' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (C:Program File...erVHyperv.psd1:String) [Import-Module], FileNot
FoundException
so can anyone advice on this please? and if there is a way to get all the VMs which are under a hyper-v windows 2008 ??
Thanks
Recent Questions...
ما را در سایت Recent Questions دنبال میکنید
برچسب:
نویسنده: استخدام کار
بازدید: 240
تاريخ: جمعه
4 تير
1395 ساعت: 19:24