Skip to main content

Get-OperatingSystem

SYNOPSIS​

Gets Operating System information

SYNTAX​

Get-OperatingSystem [[-ComputerName] <String[]>] [-Registry]
[<CommonParameters>]

DESCRIPTION​

Gets Operating System information via WMI query (Default) or Registry query (Switch.) Determines whether the computer is 32-bit or 64-bit, the Operating System name, and the OS Build number.

EXAMPLES​

EXAMPLE 1​

Get-OperatingSystem
Gets Operating System information for the local computer

EXAMPLE 2​

Get-OperatingSystem -Registry
Gets Operating System information for the local computer via Registry query instead os WMI query

EXAMPLE 3​

Get-OperatingSystem -ComputerName SERVER1
Gets Operating System information for computer SERVER1

EXAMPLE 4​

Get-OperatingSystem -ComputerName (gc c:\complist.txt) -Registry
Gets Operating System information for all computers listed in c:\complist.txt via Registry queries

PARAMETERS​

-ComputerName​

Specify computer or computer names to query

Type: String[]
Parameter Sets: (All)
Aliases: Host, Name, Computer, CN

Required: False
Position: 1
Default value: "$env:COMPUTERNAME"
Accept pipeline input: False
Accept wildcard characters: False

-Registry​

Use Registry queries instead of WMI queries

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters​

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS​

OUTPUTS​

System.Object​

NOTES​

REMARKS: For local computer it can be ran as user. For remote computers, it needs to be ran as a user who has administrative rights on the remote computer.

ALIASES​

None.

PLATFORM APPLICABILITY​

Windows only. The platform-aware loader does not export this command on Linux or macOS.

POWERSHELL COMPATIBILITY​

See PowerShell compatibility for the supported runtime policy. PowerShell 7.6 LTS is preferred.

https://docs.keldor.dev/powershell/keldor/Get-OperatingSystem