Thor Logo dbatools

Get-DbaComputerSystem

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

Synopsis

Retrieves comprehensive hardware and system information from Windows computers hosting SQL Server instances.

Description

Collects detailed system specifications including processor details, memory configuration, domain membership, and hardware information from target computers. This function is essential for SQL Server capacity planning, pre-installation system verification, and troubleshooting performance issues by providing complete hardware inventory data.

The function queries WMI classes (Win32_ComputerSystem and Win32_Processor) to gather CPU details, determines hyperthreading status, checks total physical memory, and identifies domain roles. It also detects pending reboots that could affect SQL Server operations and optionally retrieves AWS EC2 metadata for cloud-hosted instances.

Use this command when documenting SQL Server environments, verifying system requirements before installations or upgrades, or investigating hardware-related performance bottlenecks.

Syntax

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

 

Examples

 

Example: 1
PS C:\> Get-DbaComputerSystem

Returns information about the local computer’s computer system

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

Returns information about the sql2016’s computer system

Example: 3
PS C:\> Get-DbaComputerSystem -ComputerName sql2016 -IncludeAws

Returns information about the sql2016’s computer system and includes additional properties around the EC2 instance.

Optional Parameters

-ComputerName

Specifies the target computer(s) to collect system information from. Defaults to the local computer when not specified.
Use this to inventory multiple SQL Server hosts at once or to gather system details from remote servers for capacity planning and troubleshooting.

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
-IncludeAws

Retrieves additional AWS EC2 metadata when the target computer is hosted on Amazon Web Services. Adds properties like AMI ID, instance type, availability zone, and IAM role information.
Use this switch when documenting cloud-hosted SQL Server environments or when you need AWS-specific details for compliance or cost management purposes.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse
-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 specified, containing hardware and system information collected from WMI.

Default display properties (via Select-DefaultView):

  • ComputerName: The resolved computer name
  • Domain: The domain name the computer belongs to
  • DomainRole: Role of the computer (Standalone Workstation, Member Workstation, Standalone Server, Member Server, Backup Domain Controller, or Primary Domain Controller)
  • Manufacturer: Hardware manufacturer name
  • Model: Hardware model name
  • SystemFamily: System family classification
  • SystemType: System type (e.g., “x64-based PC”)
  • ProcessorName: Processor name from Win32_Processor
  • ProcessorCaption: Processor description from Win32_Processor
  • ProcessorMaxClockSpeed: Maximum processor speed in MHz
  • NumberLogicalProcessors: Number of logical processors (includes hyperthreading virtual cores)
  • NumberProcessors: Number of physical processor sockets
  • IsHyperThreading: Boolean indicating if hyperthreading is detected (logical processors > physical processors)
  • TotalPhysicalMemory: Total physical memory as a DbaSize object (shows human-readable format)
  • IsSystemManagedPageFile: Boolean indicating if Windows manages the page file automatically
  • PendingReboot: Boolean indicating if the system has a pending reboot, or $null if reboot status could not be determined

Additional properties available but not shown by default:

  • SystemSkuNumber: System SKU number from hardware
  • IsDaylightSavingsTime: Boolean indicating if daylight saving time is enabled on the system
  • DaylightInEffect: Boolean indicating if daylight saving time is currently in effect
  • DnsHostName: DNS host name of the computer
  • AdminPasswordStatus: Administrator password status (Disabled, Enabled, Not Implemented, or Unknown)

When -IncludeAws is specified and the computer is detected as an AWS EC2 instance, the following properties are added:

  • AwsAmiId: The AMI (Amazon Machine Image) ID
  • AwsIamRoleArn: The IAM instance profile ARN
  • AwsEc2InstanceId: The EC2 instance ID
  • AwsEc2InstanceType: The EC2 instance type (e.g., t2.large, m5.xlarge)
  • AwsAvailabilityZone: The AWS availability zone where the instance is located
  • AwsPublicHostName: The public hostname assigned to the EC2 instance