Will show what ProductType there is on a local computer.

Example:

switch (ProductType){

      'Workstation' {
          Write-Host "Workstation"
      }

      'Domain COntroller' {
          Write-Host "Domain Controller"
      }

      'Server' {
          Write-Host "Server"
      }
}

PowerShell
Edit|Remove
function ProductType {
# 1 = Workstation, 2 = Domain Controller, 3 = Server

$Error.Clear()

$product = Get-WmiObject -Class Win32_OperatingSystem

if ($Error.Count -gt 0) {
	Write-Host "An error occured while trying to determine ProductType"
}
else {
	switch ($product.producttype) 
    { 
        1 {"Workstation"} 
        2 {"Domain Controller"} 
        3 {"Server"} 
        default {"Not a known Product Type"}
    }
}
}