70 lines
3.5 KiB
PowerShell
70 lines
3.5 KiB
PowerShell
# https://docs.microsoft.com/en-us/powershell/module/cimcmdlets/get-ciminstance?redirectedfrom=MSDN&view=powershell-7
|
|
|
|
Get-CimInstance Win32_Diskdrive -PipelineVariable disk |
|
|
Get-CimAssociatedInstance -ResultClassName Win32_DiskPartition -PipelineVariable partition |
|
|
Get-CimAssociatedInstance -ResultClassName Win32_LogicalDisk |
|
|
Select-Object @{n='Disk';e={$disk.deviceid}},
|
|
@{n='DiskSize';e={$disk.size}},
|
|
@{n='DiskModel';e={$disk.model}},
|
|
@{n='Partition';e={$partition.name}},
|
|
@{n='RawSize';e={$partition.size}},
|
|
@{n='DriveLetter';e={$_.DeviceID}},
|
|
VolumeName,Size,FreeSpace
|
|
|
|
|
|
# Pour voir toutes les entrées:
|
|
#Get-CimInstance Win32_DiskDrive | Select-Object *
|
|
<#
|
|
InterfaceType : USB
|
|
Size : 8101900800
|
|
Caption : USB Device
|
|
Name : \\.\PHYSICALDRIVE1
|
|
MediaLoaded : True
|
|
MediaType : Removable Media
|
|
Model : USB Device
|
|
SerialNumber : AA15104200000849
|
|
#>
|
|
|
|
# Where { $_.InterfaceType -eq 'USB' }
|
|
Get-CimInstance Win32_DiskDrive -Filter "InterfaceType like 'USB%'" | Select-Object Model,SerialNumber
|
|
|
|
|
|
#Get-CimInstance Win32_LogicalDisk | % VolumeSerialNumber
|
|
#Get-CimInstance Win32_LogicalDisk | Select-Object *
|
|
<#
|
|
Name : C: | D:
|
|
Description : Disque monté local | Disque CD-ROM | Disque amovible | Connexion réseau
|
|
FreeSpace : 22891048960
|
|
Size : 89682935808
|
|
FileSystem : NTFS | FAT32 | PrlSF
|
|
ProviderName : \\Mac\Dropbox
|
|
VolumeName : BOOTCAMP | ESD-ISO | Shared Folders
|
|
VolumeSerialNumber : 02469FF7
|
|
#>
|
|
|
|
Get-CimInstance Win32_LogicalDisk | Select-Object DeviceID,Name,Description,Freespace,Size,FileSystem,ProviderName,VolumeName,VolumeSerialNumber
|
|
|
|
|
|
<#
|
|
CIM_LogicalDisk {SetPowerState, R... {Caption, Description, InstallDate, Name...}
|
|
Win32_MappedLogicalDisk {SetPowerState, R... {Caption, Description, InstallDate, Name...}
|
|
CIM_DiskPartition {SetPowerState, R... {Caption, Description, InstallDate, Name...}
|
|
Win32_DiskPartition {SetPowerState, R... {Caption, Description, InstallDate, Name...}
|
|
CIM_DiskDrive {SetPowerState, R... {Caption, Description, InstallDate, Name...}
|
|
Win32_DiskDrive {SetPowerState, R... {Caption, Description, InstallDate, Name...}
|
|
CIM_DisketteDrive {SetPowerState, R... {Caption, Description, InstallDate, Name...}
|
|
CIM_DiskSpaceCheck {Invoke} {Caption, CheckID, CheckMode, Description...}
|
|
#Win32_LogicalDiskRootDirectory {} {GroupComponent, PartComponent}
|
|
Win32_LogonSessionMappedDisk {} {Antecedent, Dependent}
|
|
CIM_LogicalDiskBasedOnPartition {} {Antecedent, Dependent, EndingAddress, StartingAddress}
|
|
Win32_LogicalDiskToPartition {} {Antecedent, Dependent, EndingAddress, StartingAddress}
|
|
CIM_LogicalDiskBasedOnVolumeSet {} {Antecedent, Dependent, EndingAddress, StartingAddress}
|
|
#Win32_DiskDrivePhysicalMedia {} {Antecedent, Dependent}
|
|
#CIM_RealizesDiskPartition {} {Antecedent, Dependent, StartingAddress}
|
|
Wi
|
|
#>
|
|
|
|
Get-CimInstance CIM_LogicalDisk | Select-Object *
|
|
Get-CimInstance CIM_DiskDrive | Select-Object *
|
|
Get-CimInstance Win32_MappedLogicalDisk | Select-Object *
|
|
Get-CimInstance Win32_DiskPartition | Select-Object * |