Posted On February 19, 2020

PowerShell: Checking Computer Type

kimconnect 0 comments
blog.KimConnect.com >> Codes >> 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
(Get-ComputerInfo).OsProductType

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

PSComputerName RunspaceId Value
-------------- ---------- -----
avvo-tableau01 289c27b8-ccfa-4124-8dd2-40f1006219a4 Server

Leave a Reply

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

Related Post

How to Install Selenium for Python on Windows or Linux

Windows # This error would occur if pip is not up to date PS C:\WINDOWS\system32>…

Enable Jumbo Frames on a Windows Host

Overview: Whether the engineer or sysadmin works in the realm of 'networking', 'database', or 'Windows',…

PowerShell: Generate a CSV Report of O365 Exchange Online Mailboxes

# Office 365 Global Admin Credential$username="[email protected]"$password=ConvertTo-securestring "PASSWORD" -AsPlainText -Force$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username,$passwordfunction…