Reputation: 821
$HyperVServerSession = New-PSSession -Name SERVER
Import-PSSession -session $HyperVServerSession -Module hyper-v -Prefix rhpv_
However, when I do a get-help rhpv_ I do not show any commands that contain that prefix.
If I do
PS C:\> get-vmhost -ComputerName SERVER
Name LogicalProcessorCount MemoryCapacity(M) VirtualMachineMigrationEnabled
---- --------------------- ----------------- ------------------------------
SERVER 12 16375.08984375 True
I can see I have commands. However, if I go to type get-vmh and tab I get
PS C:\> tmp_1d1czacs.mzd\Get-VMHost computername SERVER
tmp_1d1czacs.mzd\Get-VMHost : The term 'tmp_1d1czacs.mzd\Get-VMHost' 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:1
+ tmp_1d1czacs.mzd\Get-VMHost computername SERVER
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (tmp_1d1czacs.mzd\Get-VMHost:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Just curious if I am using the import modules from a remote host correct or if this is how PS works.
Upvotes: 0
Views: 147
Reputation: 192
$s = New-PSSession -ComputerName Server01
Invoke-Command -Session $s {Import-Module Hyper-V}
Import-PSSession -Session $s -Module Hyper-V
Upvotes: 1