-
Notifications
You must be signed in to change notification settings - Fork 0
/
Module2_Debugging.ps1
34 lines (32 loc) · 1.17 KB
/
Module2_Debugging.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
33
34
#MODULE 2
#Debugging
Write-Host "Gathering machine info..."
Write-Host " Getting OS information..." -NoNewline
$OS = Get-WmiObject win32_operatingsystem
Write-Host -ForegroundColor Green " OK"
Write-Host " Getting Network information..." -NoNewline
$Nets = Get-NetAdapter
Write-Host -ForegroundColor Green " OK"
Write-Host " Getting Disk information..." -NoNewline
$disks = Get-Disk
Write-Host -ForegroundColor Green " OK"
Write-Host " Getting Service information..." -NoNewline
$services = Get-WmiObject win32_service
Write-Host -ForegroundColor Green " OK"
Write-Host " Getting Process information..." -NoNewline
$processes = Get-Process
Write-Host -ForegroundColor Green " OK"
$machineObj = [PSCustomObject]@{
OS = "Windows $($OS.Version)"
ComputerName = $OS.PSComputerName
User = $OS.RegisteredUser
WiFiMAC = ($Nets | where Name -eq "Wi-Fi").MacAddress
WiFiLink = ($Nets | where Name -eq "Wi-Fi").LinkSpeed
DiskName = $disks.Name
DiskSerial = $disks.SerialNumber
DiskHealth = $disks.HealthStatus
DiskSize = [math]::Round($disks.DiskSize / 1GB)
Services = $services.DisplayName
Processes = $processes.Name | select -Unique
}
$machineObj