Wednesday, April 3, 2019

How to Get windows Operating System Details with PowerShell


Here is the some command to get the windows system info from Power-Shell scripts.


windows 10 name, architecture, operating system

  $sOSName = (Get-WMIObject win32_operatingsystem).name
  Write-Host "OS NAME = $sOSName " -ForegroundColor Green `n

  $sOSArchitecture = (Get-WmiObject Win32_OperatingSystem).OSArchitecture
  Write-Host "OS Architecture = $sOSArchitecture " -ForegroundColor Yellow `n

  $sSystemName = (Get-WmiObject Win32_OperatingSystem).CSName
  Write-Host "System Name = $sSystemName " -ForegroundColor Red `n



1. Get-WmiObject -Class Win32_ComputerSystem
    Get-CimInstance Win32_OperatingSystem -ComputerName dc1, dc2



2.  Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version,                 ServicePackMajorVersion, OSArchitecture, CSName, WindowsDire


     All computer Info
3.  Get-ComputerInfo -Property "os*"



   Listing BIOS Information

 4. Get-CimInstance -ClassName Win32_BIOS


5. Hot Fix Installed in windows machine.

Get-WmiObject -Class Win32_QuickFixEngineering


6. Get-CimInstance Win32_OperatingSystem | Select-Object  Caption, InstallDate,  ServicePackMajorVersion, OSArchitecture, BootDevice,  BuildNumber, CSName | FL


Note:- Please test script in your test environment before running in production directly.

No comments:

Post a Comment