API Reference
Command
Set-CxAdmxPolicy
Sets an ADMX policy by converting to LGPO items and writing to registry.pol.
Examples
Example 1
# Boolean policy
Set-CxAdmxPolicy -Name 'EnableScriptBlockLogging' -Value $true -Scope Machine -Merge -Backup
Example 2
# Decimal policy (DWORD)
Set-CxAdmxPolicy -Name 'MaximumPasswordAge' -Value 42 -Scope Machine
Example 3
# Text policy (REG_SZ)
Set-CxAdmxPolicy -Name 'LegalNoticeText' -Value 'Authorized use only.' -Scope Machine
Example 4
# Enum policy - by numeric value
Set-CxAdmxPolicy -Name 'SomeEnumPolicy' -Value 10 -Scope Machine
Example 5
# Enum policy - by raw string value
Set-CxAdmxPolicy -Name 'SomeEnumPolicy' -Value 'High' -Scope Machine
Example 6
# Enum policy - by index (#1 = second item)
Set-CxAdmxPolicy -Name 'SomeEnumPolicy' -Value '#1' -Scope Machine
Example 7
# Enum policy - by friendly DisplayName (when available via ADML)
Set-CxAdmxPolicy -Name 'SomeEnumPolicy' -Value 'High' -Scope Machine
Example 8
# List policy (REG_MULTI_SZ)
Set-CxAdmxPolicy -Name 'TrustedServers' -Value @('srv1','srv2') -Scope Machine
Example 9
# Enabled/disabled list policy (applies enabledList when -Enable is present)
Set-CxAdmxPolicy -Name 'SecurityHardeningPolicy' -Enable -Scope Machine
Example 10
# Pipeline: choose a policy first, then apply with a value
Get-CxAdmxPolicy -Name 'SomeEnumPolicy' -Language en-US | Set-CxAdmxPolicy -Value '#0' -Scope Machine
Example 11
# Remote host (admin$ share must be accessible)
Set-CxAdmxPolicy -Name 'EnableScriptBlockLogging' -Value $true -Scope Machine -ComputerName 'SERVER01'
Example 12
# Verify with RSOP after setting
Get-CxRsopPolicy -Scope Machine | Where-Object KeyPath -like '*\\Policies\\*' |
Where-Object ValueName -eq 'EnableScriptBlockLogging'
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.
Syntax
Set-CxAdmxPolicy -Name <string> [-Path <string>] [-Language <string>] [-Class <string>] [-Value <object>] [-Enable] -Scope <string> [-ComputerName <string>] [-Merge] [-Backup] [<CommonParameters>]#Parameter set:
By NameParameters
- Name string
- Name identifier for the target resource.
- Path string
- File system path to the target resource.
- Language string
- Gets or sets the Language parameter.
- Class string
- Gets or sets the Class parameter.
- Value object
- Gets or sets the Value parameter.
- Enable SwitchParameter
- Gets or sets the Enable parameter.
- Scope string
- Gets or sets the Scope parameter.
- ComputerName string
- Target computer(s). Use '.' for local computer or provide DNS names.
- Merge SwitchParameter
- Gets or sets the Merge parameter.
- Backup SwitchParameter
- Gets or sets the Backup parameter.
Outputs
System.Boolean
Set-CxAdmxPolicy [-Value <object>] [-Enable] -Scope <string> [-ComputerName <string>] [-Merge] [-Backup] -Policy <AdmxPolicy> [<CommonParameters>]#Parameter set:
By PolicyParameters
- Value object
- Gets or sets the Value parameter.
- Enable SwitchParameter
- Gets or sets the Enable parameter.
- Scope string
- Gets or sets the Scope parameter.
- ComputerName string
- Target computer(s). Use '.' for local computer or provide DNS names.
- Merge SwitchParameter
- Gets or sets the Merge parameter.
- Backup SwitchParameter
- Gets or sets the Backup parameter.
- Policy AdmxPolicy
- Gets or sets the Policy parameter.
Outputs
System.Boolean