How to disable the user configuration portion of a GPO

Turn off User or Computer settings of a GPO

Finding a way to disable either the user or computer settings of a GPO alone without disabling the entire GPO is easier said than done. However, the PowerShell script like the below can help to do so easily.
 
Provide the Fully Qualified Domain Name and GUID of GPO as parameters and run the script as is to enable computer settings and disable user settings. If you want to disable computer settings and enable user settings edit the script by replacing "$objGpo.SetComputerEnabled($true)$objGpo.SetUserEnabled($false)"
with "$objGpo.SetComputerEnabled($false)$objGpo.SetUserEnabled($true)" and execute.

Script

<#
.SYNOPSIS
This script can be used to enable computer settings and disable user settings of a GPO.
.DESCRIPTION
This script can be used to enable computer settings and disable user settings of a GPO.
.EXAMPLE
C:\PS> C:\Script\Turn_Off_User_Or_Computer_Settings.ps1 mslync10.com 31B2F340-016D-11D2-945F-00C04FB984F9
Enables computer settings and disables user settings of a DefaultDomainPolicy.
#>

param( [String]$Domain_FQDN , [String]$GPO_GUID )
$gpm = New-Object -ComObject GPMgmt.GPM
#Creates and returns a GPMConstants object that allows you to retrieve the value of multiple Group Policy Management Console (GPMC) constants.

$gpmConstants = $gpm.GetConstants()
$objDomain = $gpm.GetDomain(“$Domain_FQDN”, “”, $gpmConstants.UseAnyDC)
#Identify the GPO uniquely by using its GUID.

$objGpo = $objDomain.GetGPO(“{$GPO_GUID}”)
#set true to enable and false to disabe the user or computer settings.

$objGpo.SetComputerEnabled($true)
$objGpo.SetUserEnabled($false)















    • Related Articles

    • How to configure Microsoft 365 security settings using PowerShell

      As more organizations move to the cloud, it is becoming increasingly important to ensure the security of their Microsoft 365 environment. Microsoft provides a range of security settings that can be configured to enhance the security of your ...
    • WMI privileges for a non-administrator user using Powershell

      Administrators often find themselves working against time. In an environment where the time is of essence, certain day-to-day tasks like password resets, enabling remote access, etc., can be rationed off of technicians. However, technicians are ...
    • PowerShell for AD user reports

      Real-time insights on user account status and activity can help AD  administrators manage accounts better. Many administrators use Microsoft's PowerShell scripts to generate Active Directory reports  and pull detailed information. Below are some ...
    • Automating Active Directory user creation

      Creating a single Active Directory (AD) account is a simple task. However, in an organization, the number of AD user accounts an administrator would have to create can rise drastically, making the simple task cumbersome. This is where the process of ...
    • PowerShell as an AD user management tool

      User management can be quite a challenge for Active Directory (AD) administrators day in and day out. Many administrators use Microsoft's PowerShell technology to perform basic AD user management tasks. Below are some key PowerShell scripts and ...