I haven’t finished blogging about event 1 yet but this caught my eye.
Things aren’t too bad until we hit the bunch of write-host calls
$wrks = (Get-Content -path C:\IPList.txt)
foreach ($wrk in $wrks)
{
$osver = Get-WMIObject -class win32_operatingsystem -ComputerName $wrk
$procs = @(Get-WMIObject -class win32_processor -ComputerName $wrk)
$psok=($procs.SocketDesignation).count
$pcors=(($procs.numberofcores[0])*$psok)
$plog=($pcors * 2)
$psped=$procs.MaxClockSpeed[0]
$mem = Get-WMIObject -class win32_physicalmemory -ComputerName $wrk
$memtotal = ($mem | Measure-Object -Property capacity -Sum)
$memgb = $memtotal.sum/1gb
Write-host "*******************************************************"
Write-Host "Machine Name: " $osver.CSName
Write-Host "OS: "$osver.caption
Write-Host "Service Pack: "$osver.csdversion
Write-Host "Build #: "$osver.version
Write-Host "*********** "
Write-Host "Memory Installed:"
Write-Host "*********** "
Write-Host "Memory (GB): $memgb "
Write-Host "Slots used:" $memtotal.Count
Write-Host "*********** "
Write-Host "Processor(s) Installed:"
Write-Host "*********** "
Write-Host "Sockets:" $psok
Write-Host "Cores:" $pcors
Write-Host "Logical Procs:" $plog
Write-Host "*********** "
Write-Host "Processor Details:"
Write-Host "*********** "
$procs
Write-Host ""
}
The correct way is to create an object and output that
I’ll be blogging a sample answer when the games are over. for now be aware that write-host is worse than backticks