Quantcast
Viewing all articles
Browse latest Browse all 122

Configuring "Do not forcefully unload the users registry at user logoff" in User Profiles of Group Policy editor

I need to write a PowerShell script that should configure the below settings of Group policy in all the machines.

Gpedit.msc → Computer Configuration → Administrative Templates → System → User Profiles → "Do not forcefully unload the users registry at user logoff" to "Enabled".

As I am aware this can be done using the registry value also

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System]"DisableForceUnload"=dword:00000001

But through the script, when I add the required registry entry, the change is not reflected in the Group Policy console. Of course, I need to use the Group Policy cmdlets!When I tried with Set-GPRegistryValue with below statement

Set-GPRegistryValue -Name "User Profiles" `  -key "HKLM\SOFTWARE\Policies\Microsoft\Windows\System\" `  -ValueName DisableForceUnload -Type DWord -Value 1

It shows exception saying "A Referral was returned from the server."

Set-GPRegistryValue : A referral was returned from the server. (Exception from HRESULT: 0x8007202B)At D:\Work\XYZ\Desktop\GPO1.ps1:6 char:1+ Set-GPRegistryValue -Name "User Profiles" -key "HKLM\SOF ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : NotSpecified: (:) [Set-GPRegistryValue], COMException+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.GroupPolicy.Commands.SetGPRegistryValue    Command

What exactly I missing out here?


Viewing all articles
Browse latest Browse all 122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>