-
Notifications
You must be signed in to change notification settings - Fork 17
/
Lab4.ps1
32 lines (30 loc) · 1.19 KB
/
Lab4.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function Get-testpcinfo {
[CmdletBinding()]
param (
[Parameter()]
[string[]] $computername
)
foreach ($c in $computername) {
Invoke-Command -ComputerName $c -ScriptBlock {
# ComputerSystem info
$CompInfo = Get-CimInstance Win32_ComputerSystem
# OS info
$OSInfo = Get-CimInstance Win32_OperatingSystem
# Serial No
$BiosInfo = Get-CimInstance Win32_BIOS
$diskfreespace = get-volume -DriveLetter c | Select-Object -ExpandProperty SizeRemaining
[pscustomobject]@{
ComputerName = $CompInfo.Name
Domain = $CompInfo.Domain
OperatingSystem = $OSInfo.Caption
Model = $CompInfo.Model
MachineSN = $BiosInfo.SerialNumber
Version = $OSInfo.caption
BuildNumber = $OSInfo.version
OSArchitecture = $OSinfo.OSArchitecture
PowerShellVersion = $PSVersionTable.psversion
DiskFreeSpace = "" + [math]::Round($diskfreespace / 1GB, 2) + " GB"
}
}
}
}