PowerShell: Checking Computer Type

# Determine what type of Windows machine (client or server)
switch ((Get-CimInstance -ClassName Win32_OperatingSystem).ProductType){
1 {'client'} # ClientOs
2 {'domaincontroller'} #ServerOs
3 {'memberserver'}

# Determine whether OS is WorkStation or Server

PS C:\Windows\system32> invoke-command -computername $name -ScriptBlock {(Get-ComputerInfo).OsProductType}

PSComputerName RunspaceId Value
-------------- ---------- -----
avvo-tableau01 289c27b8-ccfa-4124-8dd2-40f1006219a4 Server
Posted on Categories Codes

Leave a Reply

Your email address will not be published. Required fields are marked *