Thor Logo dbatools

Get-DbaOperatingSystem

View Source
Shawn Melton (@wsmelton), wsmelton.github.io
Windows, Linux, macOS

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

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

 

Examples

 

Example: 1
PS C:\> Get-DbaOperatingSystem

Returns information about the local computer’s operating system

Example: 2
PS C:\> Get-DbaOperatingSystem -ComputerName sql2016

Returns information about the sql2016’s operating system

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

Returns information about the sql2016 and sql2017 operating systems using alternative Windows credentials

Example: 4
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.

PropertyValue
Aliascn,host,Server
RequiredFalse
Pipelinetrue (ByValue)
Default Value$env:COMPUTERNAME
-Credential

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

PropertyValue
Alias
RequiredFalse
Pipelinefalse
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.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse

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