mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-24 10:58:16 +02:00
Add list-system-info.ps1
This commit is contained in:
parent
27aeeb9806
commit
99197dfc29
@ -86,6 +86,7 @@ list-random-passwords.ps1, prints a list of random passwords
|
|||||||
list-random-pins.ps1, prints a list of random PIN's
|
list-random-pins.ps1, prints a list of random PIN's
|
||||||
list-scripts.ps1, lists all PowerShell scripts in this repository
|
list-scripts.ps1, lists all PowerShell scripts in this repository
|
||||||
list-services.ps1, lists the services on the local computer
|
list-services.ps1, lists the services on the local computer
|
||||||
|
list-system-info.ps1, lists system information on the local computer
|
||||||
list-tags.ps1, lists all tags in the current/given Git repository
|
list-tags.ps1, lists all tags in the current/given Git repository
|
||||||
list-tasks.ps1, lists all Windows scheduler tasks
|
list-tasks.ps1, lists all Windows scheduler tasks
|
||||||
list-timezones.ps1, lists all time zones available
|
list-timezones.ps1, lists all time zones available
|
||||||
|
|
@ -51,6 +51,7 @@ Mega Collection of PowerShell Scripts
|
|||||||
* [list-printers.ps1](Scripts/list-printers.ps1) - lists all printer known to the computer
|
* [list-printers.ps1](Scripts/list-printers.ps1) - lists all printer known to the computer
|
||||||
* [list-processes.ps1](Scripts/list-processes.ps1) - lists the local computer processes
|
* [list-processes.ps1](Scripts/list-processes.ps1) - lists the local computer processes
|
||||||
* [list-services.ps1](Scripts/list-services.ps1) - lists the services on the local computer
|
* [list-services.ps1](Scripts/list-services.ps1) - lists the services on the local computer
|
||||||
|
* [list-system-info.ps1](Scripts/list-system-info.ps1) - lists system information on the local computer
|
||||||
* [list-tasks.ps1](Scripts/list-tasks.ps1) - lists all Windows scheduler tasks
|
* [list-tasks.ps1](Scripts/list-tasks.ps1) - lists all Windows scheduler tasks
|
||||||
* [list-timezones.ps1](Scripts/list-timezones.ps1) - lists all time zones available
|
* [list-timezones.ps1](Scripts/list-timezones.ps1) - lists all time zones available
|
||||||
* [list-user-groups.ps1](Scripts/list-user-groups.ps1) - lists the user groups on the local computer
|
* [list-user-groups.ps1](Scripts/list-user-groups.ps1) - lists the user groups on the local computer
|
||||||
|
103
Scripts/list-system-info.ps1
Normal file
103
Scripts/list-system-info.ps1
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
#!/usr/bin/pwsh
|
||||||
|
<#
|
||||||
|
.SYNTAX list-system-info.ps1
|
||||||
|
.DESCRIPTION lists system information on the local computer
|
||||||
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
|
#>
|
||||||
|
|
||||||
|
# RAM
|
||||||
|
$RAM = Get-WmiObject -Query "SELECT TotalVisibleMemorySize, FreePhysicalMemory FROM Win32_OperatingSystem"
|
||||||
|
|
||||||
|
$totalRAM = [math]::Round($RAM.TotalVisibleMemorySize/1MB, 2)
|
||||||
|
$freeRAM = [math]::Round($RAM.FreePhysicalMemory/1MB, 2)
|
||||||
|
$usedRAM = [math]::Round(($RAM.TotalVisibleMemorySize - $RAM.FreePhysicalMemory)/1MB, 2)
|
||||||
|
|
||||||
|
# Operating System
|
||||||
|
$OS = Get-WmiObject -class Win32_OperatingSystem
|
||||||
|
|
||||||
|
$OS_Name = $OS.Caption
|
||||||
|
$OS_InstallDate = $OS.ConvertToDateTime($OS.InstallDate)
|
||||||
|
$OS_LastBootUpTime = $OS.ConvertToDateTime($OS.LastBootUpTime)
|
||||||
|
$OS_Architecture = $OS.OSArchitecture
|
||||||
|
$OS_SystemDrive = $OS.SystemDrive
|
||||||
|
$OS_WindowsDirectory = $OS.WindowsDirectory
|
||||||
|
$OS_BuildNumber = $OS.BuildNumber
|
||||||
|
$OS_SerialNumber = $OS.SerialNumber
|
||||||
|
$OS_Version = $OS.Version
|
||||||
|
$OS_Manufacturer = $OS.Manufacturer
|
||||||
|
|
||||||
|
# Computer System
|
||||||
|
$CS = Get-WmiObject -class Win32_ComputerSystem
|
||||||
|
|
||||||
|
$CS_Name = $CS.Name
|
||||||
|
$CS_Owner = $CS.PrimaryOwnerName
|
||||||
|
|
||||||
|
# CPU
|
||||||
|
$CPU = Get-WmiObject -class Win32_Processor
|
||||||
|
|
||||||
|
$CPU_Name = $CPU.Name
|
||||||
|
$CPU_Manufacturer = $CPU.Manufacturer
|
||||||
|
$CPU_MaxClockSpeed = $CPU.MaxClockSpeed / 1000
|
||||||
|
$CPU_Used = (Get-WmiObject win32_processor).LoadPercentage
|
||||||
|
$CPU_Free = 100 - $CPU_Used
|
||||||
|
|
||||||
|
# Disk
|
||||||
|
$Disk = Get-WmiObject -class Win32_LogicalDisk -Filter "DeviceID='C:'"
|
||||||
|
$Disk_ID = $Disk.DeviceID
|
||||||
|
$Disk_TotalSpace = [math]::Round($Disk.Size/1GB, 2)
|
||||||
|
$Disk_FreeSpace = [math]::Round($Disk.FreeSpace/1GB, 2)
|
||||||
|
$Disk_UsedSpace = [math]::Round(($Disk.Size - $Disk.FreeSpace)/1GB, 2)
|
||||||
|
|
||||||
|
# System Info
|
||||||
|
$systeminfo = systeminfo
|
||||||
|
|
||||||
|
# IP Config
|
||||||
|
$ipconfig = ipconfig
|
||||||
|
|
||||||
|
# Driver Query
|
||||||
|
$driverquery = driverquery
|
||||||
|
|
||||||
|
# Running Services
|
||||||
|
$netstart = net start
|
||||||
|
|
||||||
|
# Create info object
|
||||||
|
$infoprop = @{
|
||||||
|
'RAM_total'= $totalRAM;
|
||||||
|
'RAM_free'= $freeRAM;
|
||||||
|
'RAM_used'= $usedRAM;
|
||||||
|
'OS_Name'= $OS_Name;
|
||||||
|
'OS_InstallDate'= $OS_InstallDate;
|
||||||
|
'OS_LastBootUpTime'= $OS_LastBootUpTime;
|
||||||
|
'OS_Architecture'= $OS_Architecture;
|
||||||
|
'OS_SystemDrive'= $OS_SystemDrive;
|
||||||
|
'OS_WindowsDirectory'= $OS_WindowsDirectory;
|
||||||
|
'OS_BuildNumber'= $OS_BuildNumber;
|
||||||
|
'OS_SerialNumber'= $OS_SerialNumber;
|
||||||
|
'OS_Version'= $OS_Version;
|
||||||
|
'OS_Manufacturer'= $OS_Manufacturer;
|
||||||
|
'CS_Name'= $CS_Name;
|
||||||
|
'CS_Owner'= $CS_Owner;
|
||||||
|
'CPU_Name'= $CPU_Name;
|
||||||
|
'CPU_Manufacturer'= $CPU_Manufacturer;
|
||||||
|
'CPU_MaxClockSpeed'= $CPU_MaxClockSpeed;
|
||||||
|
'CPU_Used'= $CPU_Used;
|
||||||
|
'CPU_Free'= $CPU_Free;
|
||||||
|
'Disk_ID'= $Disk_ID;
|
||||||
|
'Disk_TotalSpace'= $Disk_TotalSpace;
|
||||||
|
'Disk_FreeSpace'= $Disk_FreeSpace;
|
||||||
|
'Disk_UsedSpace'= $Disk_UsedSpace;
|
||||||
|
'systeminfo'= $systeminfo;
|
||||||
|
'ipconfig'= $ipconfig;
|
||||||
|
'driverquery'= $driverquery;
|
||||||
|
'netstart'= $netstart;
|
||||||
|
}
|
||||||
|
|
||||||
|
$info = New-Object -TypeName PSObject -Prop $infoprop
|
||||||
|
|
||||||
|
# Convert info to JSON
|
||||||
|
$info = $info | ConvertTo-JSON
|
||||||
|
|
||||||
|
# Output
|
||||||
|
$info
|
||||||
|
exit 0
|
Loading…
Reference in New Issue
Block a user