Get-DbaOperatingSystem
View SourceSynopsis
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.
| 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 |
dbatools