---
title: "Get-DbaOperatingSystem"
description: "Retrieves comprehensive Windows operating system details from SQL Server host machines."
url: "https://dbatools.io/Get-DbaOperatingSystem/"
availability: "Windows only"
tags: ["Management", "OS", "OperatingSystem"]
author: "Shawn Melton (@wsmelton), wsmelton.github.io"
source: "https://github.com/dataplat/dbatools/blob/master/public/Get-DbaOperatingSystem.ps1"
last_updated: "2024-01-01"
---

# Get-DbaOperatingSystem

## Synopsis

Retrieves comprehensive Windows operating system details from SQL Server host machines.

## Description

Collects detailed operating system information from local or remote Windows computers hosting SQL Server instances. Returns comprehensive system details including OS version, memory configuration, power plans, time zones, and Windows Server Failover Clustering status. This information is essential for SQL Server environment assessments, capacity planning, and troubleshooting performance issues that may be related to the underlying OS configuration.

## Syntax

```powershell
Get-DbaOperatingSystem
    [[-ComputerName] <DbaInstanceParameter[]>]
    [[-Credential] <PSCredential>]
    [-EnableException]
    [<CommonParameters>]

```

## Examples

### Example 1: Returns information about the local computer&#39;s operating system

```powershell
PS C:\> Get-DbaOperatingSystem
```

### Example 2: Returns information about the sql2016&#39;s operating system

```powershell
PS C:\> Get-DbaOperatingSystem -ComputerName sql2016
```

### Example 3: Returns information about the sql2016 and sql2017 operating systems using alternative Windows credentials

```powershell
PS C:\> $wincred = Get-Credential ad\sqladmin
PS C:\> 'sql2016', 'sql2017' | Get-DbaOperatingSystem -Credential $wincred
```

### Example 4: Returns information about all the servers operating system that are stored in the file

```powershell
PS C:\> Get-Content .\servers.txt | Get-DbaOperatingSystem
```

Returns information about all the servers operating system that are stored in the file. Every line in the file can only contain one hostname for a server.  

### Optional Parameters

##### -ComputerName

Specifies the computer names of SQL Server host machines to query for operating system information. Accepts multiple computer names, IP addresses, or SQL Server instance names.  
Use this when you need to collect OS details from remote servers for environment assessments, capacity planning, or troubleshooting. Defaults to the local computer if not specified.

| Property | Value |
| --- | --- |
| Alias | cn,host,Server |
| Required | False |
| Pipeline | true (ByValue) |
| Default Value | $env:COMPUTERNAME |

##### -Credential

Alternate credential object to use for accessing the target computer(s).

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value |  |

##### -EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.  
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.  
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value | False |

## Outputs

**PSCustomObject**

Returns one object per computer containing comprehensive Windows operating system details.

**Default display properties (via Select-DefaultView):**

- ComputerName: The name of the computer
- Manufacturer: The manufacturer of the computer hardware (e.g., Dell, HP, VMware)
- Organization: The organization assigned to the computer
- Architecture: The processor architecture (x64 or x86)
- Version: The Windows version identifier
- OSVersion: The friendly operating system version name (e.g., Windows Server 2019 Standard)
- LastBootTime: DateTime of the most recent system boot
- LocalDateTime: Current DateTime on the system
- PowerShellVersion: The installed PowerShell version (e.g., 5.1)
- TimeZone: The current time zone of the system
- TotalVisibleMemory: Total physical RAM available (dbasize object with unit conversion)
- ActivePowerPlan: The active Windows power plan (e.g., High Performance)
- LanguageNative: The native name of the configured OS language

**Additional properties available (use Select-Object *):**

- Build: The Windows build number
- SPVersion: Service Pack version number
- InstallDate: DateTime when the operating system was installed
- BootDevice: The device from which the system boots
- SystemDevice: The device containing the operating system files
- SystemDrive: The drive letter of the system drive
- WindowsDirectory: The full path to the Windows directory
- PagingFileSize: Current paging file size in KB
- FreePhysicalMemory: Currently available physical RAM (dbasize object)
- TotalVirtualMemory: Total virtual memory available (dbasize object)
- FreeVirtualMemory: Currently available virtual memory (dbasize object)
- Status: Current system status
- Language: The Display name of the configured OS language
- LanguageId: The LCID (Locale ID) of the OS language
- LanguageKeyboardLayoutId: The keyboard layout ID
- LanguageTwoLetter: Two-letter ISO language code
- LanguageThreeLetter: Three-letter ISO language code
- LanguageAlias: Language alias name
- CodeSet: The code set character encoding
- CountryCode: The country code
- Locale: The locale identifier
- IsWsfc: Boolean indicating if Windows Server Failover Clustering service is installed

---

Part of [dbatools](https://dbatools.io/), a free and open source PowerShell module for SQL Server administration. Full command index: https://dbatools.io/commands/
