How remove fruit in gpo
How remove fruit in gpo
Remove-GPRegistry Value
Removes one or more registry-based policy settings from either Computer Configuration or User Configuration in a GPO.
Syntax
Description
The Remove-GPRegistryValue cmdlet removes one or more registry-based policy settings from either Computer Configuration or User Configuration in a Group Policy Object (GPO). You can specify the GPO by its display name or by its GUID.
You can specify either a key or a value:
If you specify a key, registry-based policy settings that configure any of its first-level values are removed. However, if there are registry-based policy settings that configure any subkeys or their values, an error occurs and no policy settings are removed, including those for first-level values of the key. For a key, specify the Key parameter without the ValueName parameter.
If you specify a value, the registry-based policy setting that configures that registry value is removed. For a value, specify the Key parameter without the ValueName parameter.
This cmdlet can take input from the pipeline:
You can pipe GPO objects to this cmdlet to remove a specified registry-based policy setting from one or more GPOs.
You can pipe PolicyRegistrySetting objects to this cmdlet to remove one or more registry-based policy settings from a specified GPO.
Examples
Example 1: Remove a registry-based policy setting under the specified registry key
This command removes the registry-based policy setting for the registry value HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop ScreenSaveTimeout from the GPO named TestGPO. The registry value is no longer modified when the GPO is applied on a client. Removing a policy setting does not delete the registry value on a client. To delete the registry value when the GPO is applied on a client, you must disable the policy setting by using the Set-GPRegistryValue cmdlet.
Example 2: Remove all the registry-based policy settings under the specified registry key
This command removes all the registry-based policy settings that configure first-level registry values under the key HKEY_CURRENT_USER\Software\Policies\Microsoft\ExampleKey from User Configuration in the GPO named TestGPO. If there are registry-based policy settings in User Configuration that configure registry values for any subkeys of this key, an error occurs and no first-level policy settings are removed.
Parameters
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the domain for this cmdlet. You must specify the fully qualified domain name (FQDN) of the domain.
For the Remove-GPRegistryValue cmdlet, the GPO from which to remove the registry-based policy setting must exist in this domain.
If you do not specify the Domain parameter, the domain of the user that is running the current session is used. If the cmdlet is being run from a computer startup or shutdown script, the domain of the computer is used. For more information, see the Notes section in the full Help.
If you specify a domain that is different from the domain of the user that is running the current session (or, for a startup or shutdown script, the computer), a trust must exist between that domain and the domain of the user or the computer.
You can also refer to the Domain parameter by its built-in alias, domainname. For more information, see about_Aliases.
Type: | String |
Aliases: | DomainName |
Position: | 3 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies the GPO from which to remove the registry-based policy setting by its globally unique identifier (GUID). The GUID uniquely identifies the GPO.
You can also refer to the Guid parameter by its built-in alias, id.
Type: | Guid |
Aliases: | Id |
Position: | 0 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies a registry key for which to remove one or more registry-based policy settings (for instance: HKLM\Software\Policies\Microsoft\WindowsNT\DNSClient\UseDomainNameDevolution).
The key must be in one of the two following registry hives:
HKEY_LOCAL_MACHINE (HKLM) for a registry-based policy setting in Computer Configuration.
HKEY_CURRENT_USER (HKCU) for a registry-based policy setting in User Configuration.
The Key parameter can be specified with or without the ValueName parameter:
If the ValueName parameter is specified, the registry-based policy setting that configures that registry value is removed.
If the ValueName parameter is not specified, all registry-based policy settings that configure any of the first-level values of the registry key are removed. If there are registry-based policy settings that configure any subkeys or their values, an error occurs.
You can also refer to the Key parameter by its built-in alias, FullKeyPath.
Type: | String |
Aliases: | FullKeyPath |
Position: | 1 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies the GPO from which to remove the registry-based policy setting by its display name.
The display name is not guaranteed to be unique in the domain. If another GPO with the same display name exists in the domain an error occurs. You can use the Guid parameter to uniquely identify a GPO.
You can also refer to the Name parameter by its built-in alias, displayname.
Type: | String |
Aliases: | DisplayName |
Position: | 0 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies the name of the domain controller that this cmdlet contacts to complete the operation. You can specify either the fully qualified domain name (FQDN) or the host name.
If you do not specify the name by using the Server parameter, the primary domain controller (PDC) emulator is contacted.
You can also refer to the Server parameter by its built-in alias, dc.
Type: | String |
Aliases: | DC |
Position: | 4 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the name of the registry value for which to remove the registry-based policy setting. If you specify the ValueName parameter, you must also specify the Key parameter.
Type: | String |
Position: | 2 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Microsoft.GroupPolicy.Gpo, Microsoft.GroupPolicy.PolicyRegistrySetting
You can pipe a GPO from which to remove a registry-based policy setting, or a PolicyRegistrySetting object that represents a registry-based policy setting. Collections that contain GPOs from different domains are not supported.
Outputs
Microsoft.GroupPolicy.Gpo
This cmdlet returns the GPO from which the registry-based policy setting (or settings) has been removed.
Notes
If a value for the registry key cannot be located (the registry key is not configured) or if subkeys are present, an error occurs and a corresponding error message is displayed.
You can use the Domain parameter to explicitly specify the domain for this cmdlet.
If you do not explicitly specify the domain, the cmdlet uses a default domain. The default domain is the domain that is used to access network resources by the security context under which the current session is running. This domain is typically the domain of the user that is running the session. For instance, the domain of the user who started the session by opening Windows PowerShell from the Program Files menu, or the domain of a user that is specified in a runas command. However, computer startup and shutdown scripts run under the context of the LocalSystem account. The LocalSystem account is a built-in local account, and it accesses network resources under the context of the computer account. Therefore, when this cmdlet is run from a startup or shutdown script, the default domain is the domain to which the computer is joined.
How to Add, Edit and Remove Registry Keys Using Group Policy?
In the domain environment, it’s not always possible to use Group Policy (GPO) to manage some of the Windows or applications’ settings. It’s a fact that you can apply some settings only through the system registry. In an Active Directory domain, you can centrally manage registry keys on domain computers through a GPO. In this article, we will show you how to use Group Policy to manage, add, modify, import, and delete registry keys across a domain.
Windows Server 2008 introduced a special Group Policy extension (Group Policy Preferences — GPP). It allows you to manage registry keys and parameters through the Group Policy. GPP allows you to add, remove, or modify registry parameters, values, and keys on domain-joined computers. Let’s review these possibilities.
How to Add/Set Registry Key via GPO?
Let’s say we need to disable automatic drivers updating on domain computers in a particular OU. We have to modify SearchOrderConfig key in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching.
The registry settings are available in the Computer and User configurations GPO section. Note that depending on the registry hive (HKEY_LOCAL_MACHINE / HKEY_CURRENT_USER), you must apply the settings through the Computer or User configuration GPP, respectively.
There are three options for selecting the registry key on the target PCs:
Lets’ try to use the GPO Registry Wizard to set the registry parameter value:
You can also type the full registry key path and a parameter name manually:
There are 4 types of operation with the registry items:
There are many useful options on the Common tab:
The final report with policy settings in the GPMC console looks like this:
Note. In Windows XP and Windows Server 2003, the GPP section is absent. To add it to the OS, you have to install the KB943729 update (client-side extensions for Group Policy).
How to Delete Registry Key Using the Group Policy Preferences?
You can also use GP Preferences to remove a specific key or registry entry on computers in a domain.
For example, you want to delete a certain parameter in the registry key HKEY_CURRENT_USER.
Tip. If you receive Network Path not found error when viewing the registry of a remote computer using Registry Browse, check if the specified computer is accessible over the network. Also, check if the Remote Registry service is running (this service is disabled by default). If not, use the Services console (services.msc) to start the service.
Or you can remotely check the status of the service and enable it using the following PowerShell commands:
How to Deploy a Reg File on Domain Computers Using GPO?
Let’s consider another scenario that can be used when you need to deploy a reg file with a large number of registry settings to all computers in the domain. Instead of creating individual registry settings manually in the GPP editor, you can import the reg file with the settings via the GPO startup script.
How to clear or remove domain-applied group policy settings after leaving the domain
It is a win7 ultimate x64 machine. The machine was in a domain where it got those group policy settings. Now it has left the domain but it still receives the settings from the group policy. For example, the power options. I set a certain power option but soon it will be reset to another power option which is endorsed by the domain.
Is there a way to remove the settings?
8 Answers 8
Backup your registry.
Exit the registry and restart.
Note: HKLM = HKEY_LOCAL_MACHINE & HKCU = HKEY_CURRENT_USER
Note 2: The registry is and can be a dangerous place.
If it is physically off the domain, and you ARE using a local account to log on, and it still carries the group policy settings, not only would i be very surprised, but something is wrong.
Indeed. It’s a stuck policy. Fortunately, there is a rather ingenious way to fix this problem. Unfortunately, it’s not common knowledge. Hopefully this answer will get around to enough sysadmins to fix that.
By the way, this works on all versions of Windows.
This solution is dependent upon the machine-in-question being dis-joined from the domain. If it is NOT dis-joined from the domain via the OS, then this will NOT work.
After the machine is dis-joined from the DC (Domain Controller), login using the local (machine) administrator account.
Once it’s complete, reboot. The old group policy is gone.
Basically, how this works is it (since it gets no policy when you run the command), it applies an empty policy, which effectively removes the stuck policy once and for all.
If you run into problems, run gpresult /H GPReport.html from a Command Prompt window. If you see the DC or evidence that it pulled a policy, separate your computer from the network that’s running on the DC and plug the machine into a separate network.
No internet connection is required for this solution, but the link needs to be up, and it needs to have an IP address.
Reset Local Group Policy Settings in Windows
One of the main tools to configure user and system settings in Windows is the Group Policy Objects (GPO). Local (these settings are configured locally on the computer) and domain GPOs (if a computer is joined to the Active Directory domain) can be applied to the computer and its users. However, incorrect configuration of some GPO settings can lead to various problems. Group Policy settings can block the connection of USB devices, shared printers and folder, restrict network access by the Windows Defender Firewall rules, block apps and tools from the installing or running (via SPR or AppLocker policies), restrict local or remote logons to a computer.
If you cannot logon to the computer locally, or doesn’t know exactly which of the applied GPO settings causing a problem, you have to use a script to reset the Group Policy settings to their defaults. In a “clean” state, none of the Group Policy settings are configured.
How to Reset Local Group Policy Editor (Gpedit.msc) Settings to Default?
This method involves using the GUI of the local Group Policy Editor console (gpedit.msc) to disable all configured policy settings. The local GPO graphical editor is available only in Pro, Enterprise and Education Windows 10 editions.
Do the same steps in the User Configuration section. Thus, you can disable all the settings of all settings in the Administrative GPO templates.
The above method for resetting Group Policy in Windows is suitable for the simplest cases. Incorrect GPO configuration can lead to more serious problems. For example, the inability to run the gpedit.msc snap-in or even any program or app, loss of the administrator privileges, or a restrict to logon locally. In such cases, you have to reset the saved GPO settings in local files on your computer.
Group Policy Files Registry.pol
The Windows Group Policy architecture is based on special Registry.pol files. These files store registry settings that correspond to the configured GPO settings. User and Computer policies are stored in different Registry.pol files.
During the startup, the Windows imports the contents of \Machine\Registry.pol to the system registry hive HKEY_LOCAL_MACHINE (HKLM). The contents of the file \User\Registry.pol are imported to the HKEY_CURRENT_USER (HKCU) hive when the user logs in.
When you open the Local GPO Editor Console, it loads the contents of the registry.pol files and shows them in a user-friendly graphical way. When you close the GPO editor, the changes you make are saved to the Registry.pol files. When you update the Group Policy settings on your computer (using the gpupdate /force command or on a schedule), the new settings applied to the registry.
To remove all current settings for the local GPO, you must remove the Registry.pol files in the GroupPolicy and GroupPolicyUsers folders.
Resetting all Local Group Policy Settings at Once on Windows 10/Windows Server 2016
To force a reset of all current local Group Policy settings, you must delete the Registry.pol files. It is possible to completely delete directories with policy configuration files. You can do it with the following commands, run them in the elevated command prompt:
RD /S /Q «%WinDir%\System32\GroupPolicyUsers»
RD /S /Q «%WinDir%\System32\GroupPolicy»
After that, you need to reset the old GPO settings in the registry by applying a clean GPO:
These commands will reset all local Group Policy settings in the Computer Configuration and User Configuration sections.
Open the gpedit.msc and make sure that all policies are in the Not Configured state. After running the gpedit.msc console, deleted GroupPolicyUsers and GroupPolicy folders will be created automatically with empty Registry.pol files.
The next time you make changes to Group Policy, Windows will create new Registry.pol files with the new settings.
Reset Local Security Policy Settings to Default in Windows
Restart the computer.
If you still have problems with security policies, try manually renaming the checkpoint file of the local security policy database %windir%\security\database\edb.chk.
ren %windir%\security\database\edb.chk edb_old.chk
Run the command:
gpupdate /force
Restart Windows using the shutdown command:
Shutdown –f –r –t 0
Reset Local GPO Settings without Logging in
If it is impossible to boot/login Windows, the GPSVC service is not running, you don’t have local administrator privileges, or you cannot open the command prompt (for example, apps are blocked by Applocker/SRP policy), just boot your computer from any Windows installation disc, USB flash drive or LiveCD and reset local GPO outside of the installed Windows image.
How to Clear and Remove Domain-Applied GPO settings?
A few words about domain Group Policies. If a computer is joined to an Active Directory domain, some of its settings are set by domain-based GPOs
The registry.pol files of all applied domain Group Policies are stored in the directory %windir%\System32\GroupPolicy\DataStore\0\SysVol\contoso.com\Policies. Each policy is stored in a separate folder with the domain policy GUID. After your computer leaves the AD domain, the registry.pol files of domain Group Policies on the computer will be deleted and won’t be loaded to the registry at startup. However, sometimes, despite removing a computer from the domain, GPO settings can still be applied to the computer.
The following registry keys correspond to these registry.pol files:
The versions history of the applied domain GPOs that have been used on the client is located in the following registry keys:
The local cache of applied domain GPOs is stored in the C:\ProgramData\Microsoft\Group Policy\History. Delete the files in this directory with the command::
DEL /S /F /Q “%PROGRAMDATA%\Microsoft\Group Policy\History\*.*”
Delete a GPO
Advanced Group Policy Management (AGPM) enables Approvers to delete a controlled Group Policy object (GPO), moving it to the Recycle Bin.
A user account with the Approver or AGPM Administrator (Full Control) role or necessary permissions in Advanced Group Policy Management is required to complete this procedure. Review the details in «Additional considerations» in this topic.
To delete a controlled GPO
In the Group Policy Management Console tree, click Change Control in the forest and domain in which you want to manage GPOs.
On the Contents tab, click the Controlled tab to display the controlled GPOs.
Right-click the GPO to delete, and then click Delete.
To delete the GPO from the archive while leaving the deployed version of the GPO untouched in the production environment, click Delete GPO from archive only (uncontrol).
To delete the GPO from both the archive and production environment, click Delete GPO from archive and production.
Type a comment to be displayed in the audit trail for the GPO, and then click OK.
When the Progress window indicates that overall progress is complete, click Close. The GPO is removed from the Controlled tab and is displayed on the Recycle Bin tab, where it can be restored or destroyed. If the GPO was deleted only from the archive, it is also displayed on the Uncontrolled tab.
Additional considerations
By default, you must be an Approver or an AGPM Administrator (Full Control) to delete a deployed GPO. Specifically, you must have List Contents and Delete GPO permissions for the GPO.
By default, you must be an Editor, an Approver, or an AGPM Administrator (Full Control) to delete a GPO from the archive. Specifically, you must have List Contents and either Edit Settings or Delete GPO permissions for the GPO.
Источники информации:
- http://theitbros.com/add-modify-and-delete-registry-keys-using-group-policy/
- http://superuser.com/questions/379908/how-to-clear-or-remove-domain-applied-group-policy-settings-after-leaving-the-do
- http://woshub.com/reset-local-group-policies-settings-in-windows/
- http://docs.microsoft.com/en-us/microsoft-desktop-optimization-pack/agpm/delete-a-gpo-approver