Created
August 1, 2022 18:24
-
-
Save Beercow/88a67038f8f0729a0654fb646e3aed55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enumerate USBSTOR: | |
Get-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Enum\USBSTOR\*\* |Select ` | |
@{ n = 'Vendor'; e= { ((($_.PSParentPath -split '[\\]')[-1] -split '[&]')[-3] -split 'Ven_')[-1] } }, ` | |
@{ n = 'Product'; e= { ((($_.PSParentPath -split '[\\]')[-1] -split '[&]')[-2] -split 'Prod_')[-1] } }, ` | |
@{ n = 'Version'; e= { ((($_.PSParentPath -split '[\\]')[-1] -split '[&]')[-1] -split 'Rev_')[-1] } }, ` | |
@{ n = 'Serial_Number'; e= { ($_.PSPath -split '[\\]')[-1] } }, ` | |
@{ n = 'Unique_Serial'; e= { if ((($_.PSPath -split '[\\]')[-1]) -like '?&*'){"No"} else {"Yes"} } } | Format-Table | |
Enumerate MountedDevices: | |
$key="HKLM:\SYSTEM\MountedDevices" | |
$dlvn=Get-Item $key | select -Expand property | |
$data=Get-Item $key | select -Expand property | % { | |
$value = (Get-ItemProperty -Path $key -Name $_).$_ | |
[System.Text.Encoding]::Unicode.GetString($value) | |
} | |
$dlvn | Foreach {$i=0}{new-object pscustomobject -prop @{Driveletter=$_;Data=$data[$i]}; $i++} | Format-Table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment