diff --git a/Scripts/Get-CPUse.psm1 b/Scripts/Get-CPUse.psm1 new file mode 100644 index 0000000..dd34c01 --- /dev/null +++ b/Scripts/Get-CPUse.psm1 @@ -0,0 +1,9 @@ +function Get-CPUse { + $CPU_Use_Proc = [string]((Get-CimInstance Win32_PerfFormattedData_PerfOS_Processor -ErrorAction Ignore | + Where-Object name -eq "_Total").PercentProcessorTime)+" %" + $CollectionCPU = New-Object System.Collections.Generic.List[System.Object] + $CollectionCPU.Add([PSCustomObject]@{ + CPU = $CPU_Use_Proc + }) + $CollectionCPU +} \ No newline at end of file diff --git a/Scripts/Get-Files.psm1 b/Scripts/Get-Files.psm1 new file mode 100644 index 0000000..66452e7 --- /dev/null +++ b/Scripts/Get-Files.psm1 @@ -0,0 +1,30 @@ +function Get-Files { + param ( + [Parameter(Mandatory)][string]$Path + ) + $files = Get-ChildItem $Path + $Collection_Files = New-Object System.Collections.Generic.List[System.Object] + foreach ($file in $files) { + if ($file.Length -eq 1) { + $type = "Directory" + $size = (Get-ChildItem -Path $file.FullName -Recurse -ErrorAction Ignore | Measure-Object -Property Length -Sum).Sum/1gb + $size = [string]([double]::Round($size, 3))+" GB" + } else { + $type = "File" + $size = $file.Length / 1gb + $size = [string]([double]::Round($size, 3))+" GB" + } + $Collection_Files.Add([PSCustomObject]@{ + Name = $file.Name + FullName = $file.FullName + Type = $type + Size = $size + CreationTime = Get-Date -Date $file.CreationTime -Format "dd/MM/yyyy hh:mm:ss" + LastAccessTime = Get-Date -Date $file.LastAccessTime -Format "dd/MM/yyyy hh:mm:ss" + LastWriteTime = Get-Date -Date $file.LastWriteTime -Format "dd/MM/yyyy hh:mm:ss" + }) + } + $Collection_Files +} +# Get-Files -Path "C:/" +# Get-Files -Path "C:/Program Files/" \ No newline at end of file diff --git a/Scripts/Get-Hardware.psm1 b/Scripts/Get-Hardware.psm1 index 193b4da..ddb579e 100644 --- a/Scripts/Get-Hardware.psm1 +++ b/Scripts/Get-Hardware.psm1 @@ -25,7 +25,8 @@ function Get-Hardware { $ws = ((($GetProcess).WorkingSet | Measure-Object -Sum).Sum/1gb).ToString("0.00 GB") $pm = ((($GetProcess).PM | Measure-Object -Sum).Sum/1gb).ToString("0.00 GB") $Memory = Get-CimInstance Win32_OperatingSystem - $MemUse = $Memory.TotalVisibleMemorySize - $Memory.FreePhysicalMemory + $MemUse = $Memory.TotalVisibleMemorySize - $Memory.FreePhysicalMemory + $MemUserProc = ($MemUse / $Memory.TotalVisibleMemorySize) * 100 $MEM = Get-CimInstance Win32_PhysicalMemory | Select-Object Manufacturer,PartNumber, ConfiguredClockSpeed,@{Label="Memory"; Expression={[string]($_.Capacity/1Mb)}} $MEMs = $MEM.Memory | Measure-Object -Sum @@ -65,6 +66,7 @@ function Get-Hardware { HandlesCount = $Handles_Count MemoryAll = [string]$($MEMs.Sum/1Kb)+" GB" MemoryUse = ($MemUse/1mb).ToString("0.00 GB") + MemoryUseProc = [string]([int]$MemUserProc)+" %" WorkingSet = $ws PageMemory = $pm MemorySlots = $MEMs.Count diff --git a/Scripts/Get-LD.psm1 b/Scripts/Get-LD.psm1 index a8e4588..ebf00ab 100644 --- a/Scripts/Get-LD.psm1 +++ b/Scripts/Get-LD.psm1 @@ -3,14 +3,16 @@ function Get-LD { Label="Value"; Expression={$_.DeviceID}}, @{Label="AllSize"; Expression={ ([int]($_.Size/1Gb))}},@{Label="FreeSize"; Expression={ ([int]($_.FreeSpace/1Gb))}}, @{Label="Free%"; Expression={ - [string]([int]($_.FreeSpace/$_.Size*100))+" %"}} + [string]([int]($_.FreeSpace/$_.Size*100))+" %"}},FileSystem,VolumeName $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%" + FileSystem = $_.FileSystem + VolumeName = $_.VolumeName + AllSize = [string]$_.AllSize+" Gb" + FreeSize = [string]$_.FreeSize+" Gb" + Free = $_."Free%" }) } $CollectionLD diff --git a/Scripts/Get-MemorySize.psm1 b/Scripts/Get-MemorySize.psm1 index f065bb8..2a09f60 100644 --- a/Scripts/Get-MemorySize.psm1 +++ b/Scripts/Get-MemorySize.psm1 @@ -1,15 +1,17 @@ function Get-MemorySize { $Memory = Get-CimInstance Win32_OperatingSystem $MemUse = $Memory.TotalVisibleMemorySize - $Memory.FreePhysicalMemory + $MemUserProc = ($MemUse / $Memory.TotalVisibleMemorySize) * 100 $GetProcess = Get-Process $ws = ((($GetProcess).WorkingSet | Measure-Object -Sum).Sum/1gb).ToString("0.00 GB") $pm = ((($GetProcess).PM | Measure-Object -Sum).Sum/1gb).ToString("0.00 GB") $CollectionMemory = New-Object System.Collections.Generic.List[System.Object] $CollectionMemory.Add([PSCustomObject]@{ - MemoryAll = ($memory.TotalVisibleMemorySize/1mb).ToString("0.00 GB") - MemoryUse = ($MemUse/1mb).ToString("0.00 GB") - WorkingSet = $ws - PageMemory = $pm + MemoryAll = ($memory.TotalVisibleMemorySize/1mb).ToString("0.00 GB") + MemoryUse = ($MemUse/1mb).ToString("0.00 GB") + MemoryUseProc = [string]([int]$MemUserProc)+" %" + WorkingSet = $ws + PageMemory = $pm }) $CollectionMemory } \ No newline at end of file