Open jborean93 opened 4 years ago
From @marqelme on Jan 17, 2019 19:49
@it-praktyk It is working in my environment. Is it possible that the two physical disks have the same device ID? Then this would be the problem, because the script compares the Device ID of the physical disks with the disk numbers of Get-Disk:
foreach ($disk in $disks) { $disk_info = @{} $pdisk = Get-PhysicalDisk -ErrorAction SilentlyContinue | Where-Object { $_.DeviceId -eq $disk.Number } ... }
Example, physical Device ID and Disks number are the same:
From @it-praktyk on Jan 17, 2019 20:03
PS C:\Windows\system32> Get-PhysicalDisk | fl
ObjectId : {1}\\WIN-CHMBD0MFEA4\root/Microsoft/Windows/Storage/Providers_v2\SPACES_PhysicalDisk
.ObjectId="{db04a11f-1a6a-11e9-80bf-806e6f6e6963}:PD:{44984255-1a91-11e9-80c3-806e6f
6e6963}"
PassThroughClass :
PassThroughIds :
PassThroughNamespace :
PassThroughServer :
UniqueId : IDE\DiskVBOX_HARDDISK___________________________1.0_____\5&3a5410d6&0&0.0.0:WIN-CHMB
D0MFEA4
AllocatedSize : 41943040000
BusType : ATA
CannotPoolReason : Insufficient Capacity
CanPool : False
Description :
DeviceId : 0
EnclosureNumber :
FirmwareVersion : 1.0
FriendlyName : PhysicalDisk0
HealthStatus : Healthy
IsIndicationEnabled :
IsPartial : True
LogicalSectorSize : 512
Manufacturer :
MediaType : UnSpecified
Model : VBOX HARDDISK
OperationalStatus : OK
OtherCannotPoolReasonDescription :
PartNumber :
PhysicalLocation :
PhysicalSectorSize : 512
SerialNumber : VB69f5b5da-74dc9a2f
Size : 41943040000
SlotNumber :
SoftwareVersion :
SpindleSpeed : 4294967295
SupportedUsages : {Auto-Select, Manual-Select, Hot Spare, Retired...}
Usage : Auto-Select
PSComputerName :
ObjectId : {1}\\WIN-CHMBD0MFEA4\root/Microsoft/Windows/Storage/Providers_v2\SPACES_PhysicalDisk
.ObjectId="{db04a11f-1a6a-11e9-80bf-806e6f6e6963}:PD:{44984256-1a91-11e9-80c3-806e6f
6e6963}"
PassThroughClass :
PassThroughIds :
PassThroughNamespace :
PassThroughServer :
UniqueId : IDE\DiskVBOX_HARDDISK___________________________1.0_____\5&3a5410d6&0&0.1.0:WIN-CHMB
D0MFEA4
AllocatedSize : 53687091200
BusType : ATA
CannotPoolReason : Insufficient Capacity
CanPool : False
Description :
DeviceId : 1
EnclosureNumber :
FirmwareVersion : 1.0
FriendlyName : PhysicalDisk1
HealthStatus : Healthy
IsIndicationEnabled :
IsPartial : True
LogicalSectorSize : 512
Manufacturer :
MediaType : UnSpecified
Model : VBOX HARDDISK
OperationalStatus : OK
OtherCannotPoolReasonDescription :
PartNumber :
PhysicalLocation :
PhysicalSectorSize : 512
SerialNumber : VB4b8a8cc9-b8992ce5
Size : 53687091200
SlotNumber :
SoftwareVersion :
SpindleSpeed : 4294967295
SupportedUsages : {Auto-Select, Manual-Select, Hot Spare, Retired...}
Usage : Auto-Select
PSComputerName :
PS C:\Windows\system32> Get-Disk | fl
UniqueId : IDE\DISKVBOX_HARDDISK___________________________1.0_____\5&3A5410D6&0&0.0.0:WIN-CHMBD0MFEA4
Number : 0
Path : \\?\ide#diskvbox_harddisk___________________________1.0_____#5&3a5410d6&0&0.0.0#{53f56307-b6bf-11d
0-94f2-00a0c91efb8b}
Manufacturer :
Model : VBOX HARDDISK
SerialNumber : VB69f5b5da-74dc9a2f
Size : 39.06 GB
AllocatedSize : 41943040000
LogicalSectorSize : 512
PhysicalSectorSize : 512
NumberOfPartitions : 2
PartitionStyle : MBR
IsReadOnly : False
IsSystem : True
IsBoot : True
The synopsis of the Get-Disk cmdlet: "Gets one or more disks visible to the operating system.". It probably an answer why the second physical disk is not returned - because it's not partitioned.
From @marqelme on Jan 17, 2019 20:18
Yes right, if Get-Disk does not see it, it will not appear in the facts.
From @it-praktyk on Jan 17, 2019 21:24
It can be about dynamic disks
Q: How do I use Windows PowerShell to manage my dynamic disks.
A: You don’t. The dynamic disks that have been part of Windows since Windows 2000 are being deprecated. While still available in the product, Microsoft has provided no Windows PowerShell cmdlets to manage dynamic disks. Source: Tip of the Day: Dynamic Disks and Windows PowerShell
From @it-praktyk on Jan 17, 2019 22:06
The resolution will be a usage of the command like below instead of Get-Disk
. Next, compare the results with the results of Get-Disk to identify missed (they are dynamic).
PS C:\Windows\system32> Get-CimInstance -class Win32_diskdrive | fl -Property *
ConfigManagerErrorCode : 0
LastErrorCode :
NeedsCleaning :
Status : OK
DeviceID : \\.\PHYSICALDRIVE1
StatusInfo :
Partitions : 0
BytesPerSector : 512
ConfigManagerUserConfig : False
DefaultBlockSize :
Index : 1
InstallDate :
InterfaceType : IDE
MaxBlockSize :
MaxMediaSize :
MinBlockSize :
NumberOfMediaSupported :
SectorsPerTrack : 63
Size : 53686402560
TotalCylinders : 6527
TotalHeads : 255
TotalSectors : 104856255
TotalTracks : 1664385
TracksPerCylinder : 255
Caption : VBOX HARDDISK ATA Device
Description : Disk drive
Name : \\.\PHYSICALDRIVE1
Availability :
CreationClassName : Win32_DiskDrive
ErrorCleared :
ErrorDescription :
PNPDeviceID : IDE\DISKVBOX_HARDDISK___________________________1.0_____\5&3A5410D6&0&0.1.0
PowerManagementCapabilities :
PowerManagementSupported :
SystemCreationClassName : Win32_ComputerSystem
SystemName : WIN-CHMBD0MFEA4
Capabilities : {3, 4, 10}
CapabilityDescriptions : {Random Access, Supports Writing, SMART Notification}
CompressionMethod :
ErrorMethodology :
FirmwareRevision : 1.0
Manufacturer : (Standard disk drives)
MediaLoaded : True
MediaType : Fixed hard disk media
Model : VBOX HARDDISK ATA Device
SCSIBus : 0
SCSILogicalUnit : 0
SCSIPort : 0
SCSITargetId : 1
SerialNumber : VB4b8a8cc9-b8992ce5
Signature :
PSComputerName :
CimClass : root/cimv2:Win32_DiskDrive
CimInstanceProperties : {Caption, Description, InstallDate, Name...}
CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties
ConfigManagerErrorCode : 0
LastErrorCode :
NeedsCleaning :
Status : OK
DeviceID : \\.\PHYSICALDRIVE0
StatusInfo :
Partitions : 2
BytesPerSector : 512
ConfigManagerUserConfig : False
DefaultBlockSize :
Index : 0
InstallDate :
InterfaceType : IDE
MaxBlockSize :
MaxMediaSize :
MinBlockSize :
NumberOfMediaSupported :
SectorsPerTrack : 63
Size : 41940702720
TotalCylinders : 5099
TotalHeads : 255
TotalSectors : 81915435
TotalTracks : 1300245
TracksPerCylinder : 255
Caption : VBOX HARDDISK ATA Device
Description : Disk drive
Name : \\.\PHYSICALDRIVE0
Availability :
CreationClassName : Win32_DiskDrive
ErrorCleared :
ErrorDescription :
PNPDeviceID : IDE\DISKVBOX_HARDDISK___________________________1.0_____\5&3A5410D6&0&0.0.0
PowerManagementCapabilities :
PowerManagementSupported :
SystemCreationClassName : Win32_ComputerSystem
SystemName : WIN-CHMBD0MFEA4
Capabilities : {3, 4, 10}
CapabilityDescriptions : {Random Access, Supports Writing, SMART Notification}
CompressionMethod :
ErrorMethodology :
FirmwareRevision : 1.0
Manufacturer : (Standard disk drives)
MediaLoaded : True
MediaType : Fixed hard disk media
Model : VBOX HARDDISK ATA Device
SCSIBus : 0
SCSILogicalUnit : 0
SCSIPort : 0
SCSITargetId : 0
SerialNumber : VB69f5b5da-74dc9a2f
Signature : 1315726724
PSComputerName :
CimClass : root/cimv2:Win32_DiskDrive
CimInstanceProperties : {Caption, Description, InstallDate, Name...}
CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties
From @marqelme on Jan 17, 2019 22:24
I don‘t know in this should be added if it is deprecated. Let‘s See what the ihrer guys think about it.
Outlook für iOShttps://aka.ms/o0ukef beziehen
Von: Wojciech Sciesinski notifications@github.com Gesendet: Donnerstag, Januar 17, 2019 11:08 PM An: ansible/ansible Cc: Marc Tschapek; Mention Betreff: Re: [ansible/ansible] The win_disk_facts doesn't return dynamic disks (#51032)
The resolution will be a usage of the command like below instead of Get-Disk. Next, compare the results with the results of Get-Disk to identify missed (they are dynamic).
PS C:\Windows\system32> Get-CimInstance -class Win32_diskdrive | fl -Property *
ConfigManagerErrorCode : 0 LastErrorCode : NeedsCleaning : Status : OK DeviceID : \.\PHYSICALDRIVE1 StatusInfo : Partitions : 0 BytesPerSector : 512 ConfigManagerUserConfig : False DefaultBlockSize : Index : 1 InstallDate : InterfaceType : IDE MaxBlockSize : MaxMediaSize : MinBlockSize : NumberOfMediaSupported : SectorsPerTrack : 63 Size : 53686402560 TotalCylinders : 6527 TotalHeads : 255 TotalSectors : 104856255 TotalTracks : 1664385 TracksPerCylinder : 255 Caption : VBOX HARDDISK ATA Device Description : Disk drive Name : \.\PHYSICALDRIVE1 Availability : CreationClassName : Win32_DiskDrive ErrorCleared : ErrorDescription : PNPDeviceID : IDE\DISKVBOX_HARDDISK___1.0_\5&3A5410D6&0&0.1.0 PowerManagementCapabilities : PowerManagementSupported : SystemCreationClassName : Win32_ComputerSystem SystemName : WIN-CHMBD0MFEA4 Capabilities : {3, 4, 10} CapabilityDescriptions : {Random Access, Supports Writing, SMART Notification} CompressionMethod : ErrorMethodology : FirmwareRevision : 1.0 Manufacturer : (Standard disk drives) MediaLoaded : True MediaType : Fixed hard disk media Model : VBOX HARDDISK ATA Device SCSIBus : 0 SCSILogicalUnit : 0 SCSIPort : 0 SCSITargetId : 1 SerialNumber : VB4b8a8cc9-b8992ce5 Signature : PSComputerName : CimClass : root/cimv2:Win32_DiskDrive CimInstanceProperties : {Caption, Description, InstallDate, Name...} CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties
ConfigManagerErrorCode : 0 LastErrorCode : NeedsCleaning : Status : OK DeviceID : \.\PHYSICALDRIVE0 StatusInfo : Partitions : 2 BytesPerSector : 512 ConfigManagerUserConfig : False DefaultBlockSize : Index : 0 InstallDate : InterfaceType : IDE MaxBlockSize : MaxMediaSize : MinBlockSize : NumberOfMediaSupported : SectorsPerTrack : 63 Size : 41940702720 TotalCylinders : 5099 TotalHeads : 255 TotalSectors : 81915435 TotalTracks : 1300245 TracksPerCylinder : 255 Caption : VBOX HARDDISK ATA Device Description : Disk drive Name : \.\PHYSICALDRIVE0 Availability : CreationClassName : Win32_DiskDrive ErrorCleared : ErrorDescription : PNPDeviceID : IDE\DISKVBOX_HARDDISK___1.0_\5&3A5410D6&0&0.0.0 PowerManagementCapabilities : PowerManagementSupported : SystemCreationClassName : Win32_ComputerSystem SystemName : WIN-CHMBD0MFEA4 Capabilities : {3, 4, 10} CapabilityDescriptions : {Random Access, Supports Writing, SMART Notification} CompressionMethod : ErrorMethodology : FirmwareRevision : 1.0 Manufacturer : (Standard disk drives) MediaLoaded : True MediaType : Fixed hard disk media Model : VBOX HARDDISK ATA Device SCSIBus : 0 SCSILogicalUnit : 0 SCSIPort : 0 SCSITargetId : 0 SerialNumber : VB69f5b5da-74dc9a2f Signature : 1315726724 PSComputerName : CimClass : root/cimv2:Win32_DiskDrive CimInstanceProperties : {Caption, Description, InstallDate, Name...} CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ansible/ansible/issues/51032#issuecomment-455349724, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AcZinKTOwun6Z6w-w-fwTB1ha5LpbG4Dks5vEPRBgaJpZM4aGT09.
From @it-praktyk on Jan 17, 2019 22:29
IMHO, they should be returned by win_disk_facts but can't be managed by other windisk* modules (in the future).
BTW, that has to be tested with storage spaces too.
From @it-praktyk on Jan 18, 2019 15:28
The module doesn't provide facts about disk those are storage pools members as well.
From @nitzmahone on Jan 22, 2019 20:07
+1 from Working Group discussion
From @it-praktyk on Jan 17, 2019 16:52
SUMMARY
The module returns - as the ansible facts - only information about the first physical drive.
ISSUE TYPE
COMPONENT NAME
win_disk_facts
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
I tested that using the Vagrant image of Windows Server 2012 R2 jborean93/WindowsServer2012R2 v.0.5 with the additional disk added.
STEPS TO REPRODUCE
EXPECTED RESULTS
ansible facts will contain information about all physical disks.
ACTUAL RESULTS
Only the first disk is included in the module output.
Copied from original issue: ansible/ansible#51032