Skip to content

Instantly share code, notes, and snippets.

@Goadstir
Created January 8, 2020 20:43
Show Gist options
  • Select an option

  • Save Goadstir/cff4178ec13f7c325de76809bfa89ca0 to your computer and use it in GitHub Desktop.

Select an option

Save Goadstir/cff4178ec13f7c325de76809bfa89ca0 to your computer and use it in GitHub Desktop.
PowerShell: Check if endpoint is a Desktop or Server OS
$OS = ((Get-WmiObject Win32_OperatingSystem).Name).Split("|")[0]
# Checking for Windows 7 or Windows 10 in Name
If ($OS -contains "7" -or "10") {Write-Host "It's a Desktop!"}
Else {Write-Host "It's a Server!"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment