TestimoX

API Reference

Command

Set-CxAdmxPolicy

Namespace ComputerX.PowerShell
Inputs
ComputerX.Admx.AdmxPolicy
Outputs
System.Boolean

Sets an ADMX policy by converting to LGPO items and writing to registry.pol.

Examples

Authored help example

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 Name

Parameters

Name string requiredposition: 0pipeline: false
Name identifier for the target resource.
Path string optionalposition: 1pipeline: false
File system path to the target resource.
Language string optionalposition: 2pipeline: false
Gets or sets the Language parameter.
Class string optionalposition: 3pipeline: false
Gets or sets the Class parameter.
Value object optionalposition: 4pipeline: false
Gets or sets the Value parameter.
Enable SwitchParameter optionalposition: 5pipeline: false
Gets or sets the Enable parameter.
Scope string requiredposition: 6pipeline: false
Gets or sets the Scope parameter.
ComputerName string optionalposition: 7pipeline: false
Target computer(s). Use '.' for local computer or provide DNS names.
Merge SwitchParameter optionalposition: 8pipeline: false
Gets or sets the Merge parameter.
Backup SwitchParameter optionalposition: 9pipeline: false
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 Policy

Parameters

Value object optionalposition: 4pipeline: false
Gets or sets the Value parameter.
Enable SwitchParameter optionalposition: 5pipeline: false
Gets or sets the Enable parameter.
Scope string requiredposition: 6pipeline: false
Gets or sets the Scope parameter.
ComputerName string optionalposition: 7pipeline: false
Target computer(s). Use '.' for local computer or provide DNS names.
Merge SwitchParameter optionalposition: 8pipeline: false
Gets or sets the Merge parameter.
Backup SwitchParameter optionalposition: 9pipeline: false
Gets or sets the Backup parameter.
Policy AdmxPolicy requiredposition: namedpipeline: true (ByValue)
Gets or sets the Policy parameter.

Outputs

System.Boolean