top of page

PowerShell - Discover Server Details from Text file (Uses get-wmiobject)

  • Writer: Jon Boyette
    Jon Boyette
  • Jan 7, 2022
  • 1 min read


Very Nicely Detailed on screen output from list, build a text and save as a .ps1

$A = Get-Content "c:\temp\addyourtextfile.txt"

#Specify the list of PC names in the line above. "." means local system


Clear-Host

foreach ($Computer in $A)

{

$computerSystem = get-wmiobject Win32_ComputerSystem -Computer $Computer

$computerBIOS = get-wmiobject Win32_BIOS -Computer $Computer

$computerOS = get-wmiobject Win32_OperatingSystem -Computer $Computer

$computerCPU = get-wmiobject Win32_Processor -Computer $Computer

$computerHDD = Get-WmiObject Win32_LogicalDisk -ComputerName $Computer -Filter drivetype=3

write-host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan

"-------------------------------------------------------"

"Manufacturer: " + $computerSystem.Manufacturer

"Model: " + $computerSystem.Model

"Serial Number: " + $computerBIOS.SerialNumber

"CPU: " + $computerCPU.Name

"HDD Capacity C: " + "{0:N2}" -f ($computerHDD.Size[0]/1GB) + "GB"

"HDD Space C: " + "{0:P2}" -f ($computerHDD.FreeSpace[0]/$computerHDD.Size[0]) + " Free (" + "{0:N2}" -f ($computerHDD.FreeSpace[0]/1GB) + "GB)"

"RAM: " + "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB) + "GB"

"Operating System: " + $computerOS.caption + ", Service Pack: " + $computerOS.ServicePackMajorVersion

"User logged In: " + $computerSystem.UserName

"Last Reboot: " + $computerOS.ConvertToDateTime($computerOS.LastBootUpTime)

""

"-------------------------------------------------------"

}



 
 
 

Recent Posts

See All
PowerShell - List All Domain SPNs

Save as same List_ALL_SPNs.ps1 or similar, this LDap calls the Domain for all Service Principal names and accounts related #Build LDAP...

 
 
 
PowerShell - Start-Monitoring

This is a great script used to Monitor and Email if a server is up or down, once ran, and smtp and from address is set, then run:...

 
 
 

Comments


Post: Blog2 Post
  • Facebook
  • Twitter
  • LinkedIn

©2022 by Boyette Technical Services. Proudly created with Wix.com

bottom of page