Add modules from WinAPI (process managment and cim hardware)

This commit is contained in:
Alex Kup 2023-12-12 16:39:28 +03:00 committed by GitHub
parent 3514ec6e3d
commit bbfdb5d61f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 243 additions and 0 deletions

17
Scripts/Get-LD.psm1 Normal file
View file

@ -0,0 +1,17 @@
function Get-LD {
$LogicalDisk = Get-CimInstance Win32_logicalDisk | Where-Object {$null -ne $_.Size} | Select-Object @{
Label="Value"; Expression={$_.DeviceID}}, @{Label="AllSize"; Expression={
([int]($_.Size/1Gb))}},@{Label="FreeSize"; Expression={
([int]($_.FreeSpace/1Gb))}}, @{Label="Free%"; Expression={
[string]([int]($_.FreeSpace/$_.Size*100))+" %"}}
$CollectionLD = New-Object System.Collections.Generic.List[System.Object]
$LogicalDisk | ForEach-Object {
$CollectionLD.Add([PSCustomObject]@{
Logical_Disk = $_.Value
AllSize = [string]$_.AllSize+" Gb"
FreeSize = [string]$_.FreeSize+" Gb"
Free = $_."Free%"
})
}
$CollectionLD
}