add pode and api scripts
This commit is contained in:
parent
30a3d7711e
commit
94bc297ea1
20 changed files with 783 additions and 3 deletions
33
Scripts/Get-Size.psm1
Normal file
33
Scripts/Get-Size.psm1
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
function Get-Size {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Remote and local check use and all memory or space logical disk
|
||||
For remote use applyed Invoke-Command via WinRM for memory and WMI for logical disk
|
||||
.DESCRIPTION
|
||||
Example:
|
||||
Get-Size -disk localhost # default
|
||||
Get-Size -memory localhost
|
||||
.LINK
|
||||
https://github.com/Lifailon
|
||||
#>
|
||||
Param (
|
||||
$srv="localhost",
|
||||
[switch]$memory,
|
||||
[switch]$disk
|
||||
)
|
||||
if ($memory) {
|
||||
if ($srv -like "localhost") {
|
||||
$mem = Get-ComputerInfo
|
||||
} else {
|
||||
$mem = Invoke-Command -ComputerName $srv -ScriptBlock {Get-ComputerInfo}
|
||||
}
|
||||
$mem | select @{
|
||||
Label="Size"; Expression={[string]($_.CsPhyicallyInstalledMemory/1mb)+" Gb"}},
|
||||
@{Label="Free"; Expression={[string]([int]($_.OsFreePhysicalMemory/1kb))+" Mb"}}
|
||||
} else {
|
||||
gwmi Win32_logicalDisk -ComputerName $srv | select @{Label="Volume"; Expression={$_.DeviceID}},
|
||||
@{Label="Size"; Expression={[string]([int]($_.Size/1Gb))+" Gb"}},
|
||||
@{Label="Free"; Expression={[string]([int]($_.FreeSpace/1Gb))+" Gb"}},
|
||||
@{Label="%Free"; Expression={[string]([int]($_.FreeSpace/$_.Size*100))+" %"}}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue