# Get-MtADDomainState

Collects Active Directory domain state information.

Source: https://maester.dev/docs/commands/Get-MtADDomainState

## SYNOPSIS

Collects Active Directory domain state information.

## SYNTAX

```powershell
Get-MtADDomainState [-Refresh] [[-ComputerName] <String>] [[-DnsTimeoutSeconds] <Int32>]
 [[-MaxZoneCount] <Int32>] [[-MaxRecordCount] <Int32>] [[-Categories] <String[]>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

## DESCRIPTION

Collects comprehensive domain state including domain info, forest info,
computers, users, groups, domain controllers, replication sites, etc.
Results are cached for the session to avoid repeated queries.
Connect-Maester -Service ActiveDirectory must complete successfully before this command can collect or return data.

## EXAMPLES

### EXAMPLE 1

```powershell
Get-MtADDomainState
```

Returns cached domain state or collects if not already cached.
Returns no data unless Active Directory was explicitly connected through Connect-Maester.

### EXAMPLE 2

```powershell
Get-MtADDomainState -Refresh
```

Forces a fresh collection of domain state data from Active Directory.

### EXAMPLE 3

```powershell
Get-MtADDomainState -ComputerName dc01.contoso.com
```

Collects domain state data by targeting dc01.contoso.com for supported Active Directory and DNS queries.

### EXAMPLE 4

```powershell
Get-MtADDomainState -Categories Domain,Users
```

Collects only the Domain and Users categories (plus any dependencies).

## PARAMETERS

### -Refresh

Forces a refresh of the data from Active Directory, bypassing the cache.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### -ComputerName

Specifies an Active Directory domain controller or AD DS server to target for
data collection.
When provided, LDAP and DNS queries are directed to this
server.
If not specified, the target selected by Connect-Maester is used.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DnsTimeoutSeconds

Specifies the timeout, in seconds, for remote DNS inventory collection.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: 60
Accept pipeline input: False
Accept wildcard characters: False
```

### -MaxZoneCount

Specifies the maximum number of DNS zones that may be normalized.
Collection
fails explicitly if the remote inventory exceeds this value.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: 500
Accept pipeline input: False
Accept wildcard characters: False
```

### -MaxRecordCount

Specifies the maximum number of DNS records that may be normalized.
Collection
fails explicitly if the remote inventory exceeds this value.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: 10000
Accept pipeline input: False
Accept wildcard characters: False
```

### -Categories

Specifies one or more category names to collect.
When omitted, all categories
are collected (legacy behavior).
Dependencies are automatically resolved and
collected first.
Valid values: Domain, FineGrainedPasswordPolicies, Forest,
Computers, Users, Groups, ServiceAccounts, DomainControllers, ReplicationSites,
Subnets, OptionalFeatures, ReplicationConnections, DfsrSubscriptions, Trusts,
OrganizationalUnits, SmbConfigurations, DNS, Configuration, Schema, Printers,
DaclEntries.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ProgressAction

Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.

```yaml
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

### System.Collections.Specialized.OrderedDictionary

## NOTES

## RELATED LINKS

[https://maester.dev/docs/commands/Get-MtADDomainState](https://maester.dev/docs/commands/Get-MtADDomainState)
