commands

^

Get-DbaOperatingSystem

Author Shawn Melton (@wsmelton), wsmelton.github.io
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Get-DbaOperatingSystem on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaOperatingSystem.

Synopsis

Gets operating system information from the server.

Description

Gets operating system information from the server and returns as an object.

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

Target computer(s). If no computer name is specified, the local computer is targeted

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).

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.

Alias
Required False
Pipeline false
Default Value False