I’ve run some tests on this from a Windows 2016 server going to a Nano server
First I repeated the initial script
$job = Invoke-Command -ComputerName W16HV01 -ScriptBlock {
Get-PhysicalDisk
}
$job | select -first 1 | select OperationalStatus
OperationalStatus
-----------------
{2}
And got the same results.
Then tested a script block in same scenario. This is to see everything that is returned
$sb = {
Get-PhysicalDisk
}
Invoke-Command -ComputerName W16HV01 -ScriptBlock $sb
ClassName : MSFT_PhysicalDisk
PSComputerName : W16HV01
RunspaceId : ead58759-1957-4d2b-97a6-facdd3bb12cc
ObjectId : {1}\\W16HV01\root/Microsoft/Windows/Storage/
Providers_v2\SPACES_PhysicalDisk.ObjectId="{
58d6ee13-a3df-11e6-bbb0-806e6f6e6963}:PD:{8a
4a1916-e842-d36e-67b9-973488c51a7a}"
PassThroughClass :
PassThroughIds :
PassThroughNamespace :
PassThroughServer :
UniqueId : 60022480B03EB44066A35B8D6963D320
Description :
FriendlyName : Msft Virtual Disk
HealthStatus : 0
Manufacturer : Msft
Model : Virtual Disk
OperationalDetails :
OperationalStatus : {2}
PhysicalLocation : Integrated : Adapter 0 : Port 0 : Target 0
: LUN 0
SerialNumber :
AdapterSerialNumber :
AllocatedSize : 10737418240
BusType : 10
CannotPoolReason : {7}
CanPool : False
DeviceId : 0
EnclosureNumber :
FirmwareVersion : 1.0
IsIndicationEnabled :
IsPartial : True
LogicalSectorSize : 512
MediaType : 0
OtherCannotPoolReasonDescription :
PartNumber :
PhysicalSectorSize : 4096
Size : 10737418240
SlotNumber :
SoftwareVersion :
SpindleSpeed : 4294967295
SupportedUsages : {1, 2, 3, 4...}
UniqueIdFormat : 3
Usage : 1
VirtualDiskFootprint : 0
Got the same results
next try a remoting session
$sb = {
Get-PhysicalDisk
}
$s = New-PSSession -ComputerName W16HV01
Invoke-Command -Session $s -ScriptBlock $sb
Remove-PSSession $s
ClassName : MSFT_PhysicalDisk
PSComputerName : W16HV01
RunspaceId : 0afd86d2-fdfb-4df5-90cd-e820a0624ef5
ObjectId : {1}\\W16HV01\root/Microsoft/Windows/Storage/
Providers_v2\SPACES_PhysicalDisk.ObjectId="{
58d6ee13-a3df-11e6-bbb0-806e6f6e6963}:PD:{8a
4a1916-e842-d36e-67b9-973488c51a7a}"
PassThroughClass :
PassThroughIds :
PassThroughNamespace :
PassThroughServer :
UniqueId : 60022480B03EB44066A35B8D6963D320
Description :
FriendlyName : Msft Virtual Disk
HealthStatus : 0
Manufacturer : Msft
Model : Virtual Disk
OperationalDetails :
OperationalStatus : {2}
PhysicalLocation : Integrated : Adapter 0 : Port 0 : Target 0
: LUN 0
SerialNumber :
AdapterSerialNumber :
AllocatedSize : 10737418240
BusType : 10
CannotPoolReason : {7}
CanPool : False
DeviceId : 0
EnclosureNumber :
FirmwareVersion : 1.0
IsIndicationEnabled :
IsPartial : True
LogicalSectorSize : 512
MediaType : 0
OtherCannotPoolReasonDescription :
PartNumber :
PhysicalSectorSize : 4096
Size : 10737418240
SlotNumber :
SoftwareVersion :
SpindleSpeed : 4294967295
SupportedUsages : {1, 2, 3, 4...}
UniqueIdFormat : 3
Usage : 1
VirtualDiskFootprint : 0
same results
Try an interactive remoting session
PS C:\Scripts> Enter-PSSession -ComputerName W16HV01
[W16HV01]: PS C:\Users\Richard\Documents> get-physicaldisk
FriendlyName SerialNumber CanPool OperationalStatus HealthStatus Usage
------------ ------------ ------- ----------------- ------------ -----
Msft Virtual Disk False OK Healthy Auto-S...
That gives the expected result
Now try a CIM session
$cs = New-CimSession -ComputerName W16HV01
Get-PhysicalDisk -CimSession $cs
Remove-CimSession $cs
FriendlyName SerialNumber CanPool OperationalStatus HealthStatus Usage Size
------------ ------------ ------- ----------------- ------------ ----- ----
Msft Virtual Disk False OK Healthy Auto-Select 10 GB
That work as well
Last test is to try PowerShell Direct from the Hyper-V host which is Windows 10
PS> $cred = Get-Credential "W16HV01\Administrator"
$s = New-PSSession -VMName W16HV01 -Credential $cred
Invoke-Command -Session $s -ScriptBlock {get-PhysicalDisk}
Remove-PSSession $s
ClassName : MSFT_PhysicalDisk
PSComputerName : W16HV01
RunspaceId : 2e29e8d0-07ad-482b-b466-9e37c8fc4b5d
ObjectId : {1}\\W16HV01\root/Microsoft/Windows/Storage/Providers_v2\SPACES_PhysicalDisk.ObjectId="{58d6ee13-a3df-11e6-bbb0-
806e6f6e6963}:PD:{8a4a1916-e842-d36e-67b9-973488c51a7a}"
PassThroughClass :
PassThroughIds :
PassThroughNamespace :
PassThroughServer :
UniqueId : 60022480B03EB44066A35B8D6963D320
Description :
FriendlyName : Msft Virtual Disk
HealthStatus : 0
Manufacturer : Msft
Model : Virtual Disk
OperationalDetails :
OperationalStatus : {2}
PhysicalLocation : Integrated : Adapter 0 : Port 0 : Target 0 : LUN 0
SerialNumber :
AdapterSerialNumber :
AllocatedSize : 10737418240
BusType : 10
CannotPoolReason : {7}
CanPool : False
DeviceId : 0
EnclosureNumber :
FirmwareVersion : 1.0
IsIndicationEnabled :
IsPartial : True
LogicalSectorSize : 512
MediaType : 0
OtherCannotPoolReasonDescription :
PartNumber :
PhysicalSectorSize : 4096
Size : 10737418240
SlotNumber :
SoftwareVersion :
SpindleSpeed : 4294967295
SupportedUsages : {1, 2, 3, 4...}
UniqueIdFormat : 3
Usage : 1
VirtualDiskFootprint : 0
That gives original result
Last test was to try against Windows 2016 remote machine (server core)
PS C:\Scripts> Invoke-Command -ScriptBlock {Get-PhysicalDisk} -ComputerName W16DC01
FriendlyName SerialNumber CanPool OperationalStatus HealthStatus Usage Size PSComputerName
------------ ------------ ------- ----------------- ------------ ----- ---- --------------
Msft Virtual Disk False OK Healthy Auto-Select 127 GB W16DC01
which works OK
Looks like there could be an issue with remoting CIM based cmdlets to Nano server