Edit Local Group Policy Using Powershell

You can do it in PowerShell using Set-ItemProperty on the Registry provider; e.g. to disable Windows Update Access, you can run:

Set-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate -Name DisableWindowsUpdateAccess -Value 1

(HKLM:\ being the standard alias for the "Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\" registry drive path.)

List of Group Policy registry keys can be downloaded from Microsoft at Download Group Policy Settings Reference for Windows and Windows Server | Microsoft Download Center


auditpol /get /category:'Logon/Logoff' /r
auditpol /set /Subcategory:'{0CCE9215-69AE-11D9-BED3-505054503030}' /failure:enable /success:enable
auditpol /set /Subcategory:'{0CCE9216-69AE-11D9-BED3-505054503030}' /failure:enable /success:enable

Auditpol dsc

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet -MinimumVersion -Force
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Install-Module -Name AuditPolicyDsc -RequiredVersion

Configuration Sample_AuditPolicyGuid
        [String] $NodeName = 'localhost'

    Import-DscResource -ModuleName AuditPolicyDsc

    Node $NodeName
        AuditPolicyGuid LogonSuccess
            Name      = 'Logon'
            AuditFlag = 'Success'
            Ensure    = 'Absent'

        AuditPolicyGuid LogonFailure
            Name      = 'Logon'
            AuditFlag = 'Failure'
            Ensure    = 'Present'