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)