API Reference
Command
Set-CxAuditPolicy
Sets advanced Audit Policy on a local or remote Windows host.
Examples
Example 1
$items = Get-CxAuditPolicy -Source LocalPolicyCsv | ? Subcategory -eq 'Process Creation'; $items[0].Flags = 'SuccessAndFailure'; Set-CxAuditPolicy -Source LocalPolicyCsv -Items $items -RefreshPolicy
Example 2
$items = Get-CxAuditPolicy -ComputerName SRV1 -Source Registry; $items | % { if ($_.Subcategory -eq 'Logon') { $_.Flags = 'SuccessAndFailure' } }; Set-CxAuditPolicy -ComputerName SRV1 -Source Registry -Items $items -AdjustRegistryAcl -BackupBefore -WhatIf
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-CxAuditPolicy [-ComputerName <string>] -Source <Native|LocalPolicyCsv|Registry> -Items <AuditSubcategorySetting[]> [-AdjustRegistryAcl] [-BackupBefore] [-RefreshPolicy] [<CommonParameters>]#Parameters
- ComputerName string
- Target host. If omitted, sets the local machine.
- Source AuditPolicySource
- Data source to write: LocalPolicyCsv, Native, or Registry. Possible values: Native, LocalPolicyCsv, Registry
- Possible values:
Native,LocalPolicyCsv,Registry - Items AuditSubcategorySetting[]
- Audit subcategory settings to apply (can be piped from Get-CxAuditPolicy).
- AdjustRegistryAcl SwitchParameter
- When using Registry source, temporarily relax ACL on the policy hive to allow writes.
- BackupBefore SwitchParameter
- Create a backup before applying changes (CSV path or registry binary).
- RefreshPolicy SwitchParameter
- For CSV source: on local host, runs 'gpupdate /force' after writing Audit.csv.