63 lines
2.2 KiB
PowerShell
63 lines
2.2 KiB
PowerShell
<#
|
|
Author: Gabe Kerntke
|
|
Date: 12-09-2023
|
|
|
|
.Synopsis
|
|
|
|
.Modified
|
|
2023-12-09 (GabeK) - Original script created
|
|
|
|
#>
|
|
|
|
[CmdletBinding(ConfirmImpact = 'Low')]
|
|
Param(
|
|
[Parameter(Mandatory = $false,
|
|
ValueFromPipeLine = $true,
|
|
ValueFromPipeLineByPropertyName = $true,
|
|
Position = 0)]
|
|
[String[]]$ComputerName = $env:COMPUTERNAME
|
|
)
|
|
|
|
# Start Script #
|
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
|
|
|
|
#Get-CimInstance -ClassName Win32_Desktop | Select-Object Name, ScreenSaverActive, ScreenSaverTimeout | Where-Object [ScreenSaverActive -eq True]
|
|
|
|
Get-CimInstance -ClassName Win32_BIOS
|
|
|
|
Get-CimInstance -ClassName Win32_ComputerSystem | Format-List
|
|
|
|
$test = Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -ExpandProperty TotalPhysicalMemory
|
|
$test2 = $test / 1GB
|
|
$test2.Tostring(".00") + "GB"
|
|
|
|
Get-CimInstance -ClassName Win32_Processor | Select-Object -ExpandProperty Name
|
|
|
|
Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -ExpandProperty SystemType
|
|
|
|
$Result = @()
|
|
foreach ($Computer in $ComputerName) {
|
|
try {
|
|
Get-WmiObject -ComputerName $Computer -Class Win32_logicaldisk -ErrorAction Stop | Where-Object { $_.DriveType -eq 3 } | ForEach-Object {
|
|
$Query = "SELECT BlockSize FROM Win32_volume WHERE DriveLetter ='$($_.DeviceID)'"
|
|
$Splatt = @{
|
|
ComputerName = $Computer
|
|
DriveLetter = $_.DeviceID
|
|
'BlockSize(KB)' = (Get-WmiObject -ComputerName $Computer -Query $Query).Blocksize / 1KB
|
|
Description = $_.Description
|
|
FileSystem = $_.FileSystem
|
|
'Size(GB)' = '{0:N0}' -f ($_.Size / 1GB)
|
|
'Free(GB)' = '{0:N0}' -f ($_.FreeSpace / 1GB)
|
|
'Free(%)' = '{0:N0}' -f ($_.FreeSpace / $_.Size * 100)
|
|
Compressed = $_.Compressed
|
|
VolumeName = $_.VolumeName
|
|
}
|
|
$Result += New-Object -TypeName PSObject -Property $Splatt
|
|
}
|
|
}
|
|
catch {
|
|
Write-Verbose "Unable to read disk information from computer $Computer"
|
|
}
|
|
}
|
|
$Result | Select-Object ComputerName, DriveLetter, 'BlockSize(KB)', 'Size(GB)', 'Free(GB)', 'Free(%)', FileSystem, Compressed, VolumeName, Description
|
|
# End Script # |