Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

detectostype

Journey edited this page Nov 17, 2020 · 1 revision

This helps to detect the OS type

$osInfo = (Get-CimInstance -Class Win32_OperatingSystem).ProductType

if the result is:

  • 1 => Workstation
  • 2 => Domain controller
  • 3 => Simple Server

or

$osInfo = (Get-CimInstance -Class Win32_OperatingSystem).Caption

Results in example:

  • Microsoft Windows 10 Pro for Workstations
Clone this wiki locally