Update Utility Scripts/Display Computer Info.ps1
This commit is contained in:
@@ -1,32 +1,63 @@
|
|||||||
<#
|
<#
|
||||||
Author: Gabe Kerntke
|
Author: Gabe Kerntke
|
||||||
Date: 12-09-2023
|
Date: 12-09-2023
|
||||||
|
|
||||||
.Synopsis
|
.Synopsis
|
||||||
|
|
||||||
.Modified
|
.Modified
|
||||||
2023-12-09 (GabeK) - Original script created
|
2023-12-09 (GabeK) - Original script created
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
# Variables #
|
[CmdletBinding(ConfirmImpact = 'Low')]
|
||||||
|
Param(
|
||||||
# Functions #
|
[Parameter(Mandatory = $false,
|
||||||
|
ValueFromPipeLine = $true,
|
||||||
# Start Script #
|
ValueFromPipeLineByPropertyName = $true,
|
||||||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
|
Position = 0)]
|
||||||
|
[String[]]$ComputerName = $env:COMPUTERNAME
|
||||||
#Get-CimInstance -ClassName Win32_Desktop | Select-Object Name, ScreenSaverActive, ScreenSaverTimeout | Where-Object [ScreenSaverActive -eq True]
|
)
|
||||||
|
|
||||||
Get-CimInstance -ClassName Win32_BIOS
|
# Start Script #
|
||||||
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
|
||||||
Get-CimInstance -ClassName Win32_ComputerSystem | Format-List
|
|
||||||
|
#Get-CimInstance -ClassName Win32_Desktop | Select-Object Name, ScreenSaverActive, ScreenSaverTimeout | Where-Object [ScreenSaverActive -eq True]
|
||||||
$test = Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -ExpandProperty TotalPhysicalMemory
|
|
||||||
$test2 = $test/1GB
|
Get-CimInstance -ClassName Win32_BIOS
|
||||||
$test2.Tostring(".00") + "GB"
|
|
||||||
|
Get-CimInstance -ClassName Win32_ComputerSystem | Format-List
|
||||||
Get-CimInstance -ClassName Win32_Processor | Select-Object -ExpandProperty Name
|
|
||||||
|
$test = Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -ExpandProperty TotalPhysicalMemory
|
||||||
Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -ExpandProperty SystemType
|
$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 #
|
# End Script #
|
||||||
Reference in New Issue
Block a user