From 1b6125edfaea73fc5ee9241dff82cef5a6a71ccf Mon Sep 17 00:00:00 2001 From: Alex Kup <116945542+Lifailon@users.noreply.github.com> Date: Tue, 19 Dec 2023 01:11:41 +0300 Subject: [PATCH] Add modules from WinAPI --- Scripts/Get-Hardware.psm1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Scripts/Get-Hardware.psm1 b/Scripts/Get-Hardware.psm1 index ddb579e..5ea4ab4 100644 --- a/Scripts/Get-Hardware.psm1 +++ b/Scripts/Get-Hardware.psm1 @@ -10,6 +10,7 @@ function Get-Hardware { $SYS = Get-CimInstance Win32_ComputerSystem $BootTime = Get-CimInstance -ComputerName $srv Win32_OperatingSystem | Select-Object LocalDateTime,LastBootUpTime $Uptime = ([string]($BootTime.LocalDateTime - $BootTime.LastBootUpTime) -split ":")[0,1] -join ":" + $BootDate = Get-Date -Date $BootTime.LastBootUpTime -Format "dd/MM/yyyy hh:mm:ss" $OS = Get-CimInstance Win32_OperatingSystem $BB = Get-CimInstance Win32_BaseBoard $BBv = $BB.Manufacturer+" "+$BB.Product+" "+$BB.Version @@ -53,7 +54,7 @@ function Get-Hardware { $Collection.Add([PSCustomObject]@{ Host = $SYS.Name Uptime = $uptime - BootTime = $BootTime.LastBootUpTime + BootDate = $BootDate Owner = $SYS.PrimaryOwnerName OS = $OS.Caption Motherboard = $BBv @@ -63,7 +64,7 @@ function Get-Hardware { CPU = $CPU_Use_Proc ProcessCount = $Process_Count ThreadsCount = $Threads_Count - HandlesCount = $Handles_Count + HandlesCount = [int]$Handles_Count MemoryAll = [string]$($MEMs.Sum/1Kb)+" GB" MemoryUse = ($MemUse/1mb).ToString("0.00 GB") MemoryUseProc = [string]([int]$MemUserProc)+" %"