Group policy for updating registry on client computers

Summary: Microsoft Scripting Guy, Ed Wilson, shows how to force a domain-wide update of Group Policy by using Windows Power Shell. Well, tomorrow, the Scripting Wife and I leave for a three-week European Windows Power Shell tour.

We will be doing five Windows Power Shell user groups and meeting with over a dozen Windows Power Shell MVPs, and other people from the Windows Power Shell community.

To update Group Policy settings, I use the GPUpdateutility. By default, GPUpdate updates both computer and user portions of Group Policy. By default, GPUpdate will update only modified Group Policy settings. The first thing I need to do is to obtain a collection of all the computers on the domain.

But, I can control that by using the /target parameter. PS C:\ gpupdate /target:computer Updating policy... If I want to update all settings, use the /force parameter. To do this, I use the Get-ADComputer cmdlet from the Active Directory module.

For example, if I only want to update the computer portion of the policy, I use the /target:computer. The command shown here updates all settings (regardless if they are modified) for both the computer and the user portions of Group Policy. Note The Active Directory module is available from the RSAT tools.

I store the returned computer objects in a variable named $cn. $cn = Get-ADComputer -filt * The second thing I need to do is to create a remote session with all the remote computers.

At times, I have to call the Help desk at work, and the answer is to refresh Group Policy on my local computer.

I can easily use Invoke-Command to retrieve this information. icm -Session $session -Script Block The command and associated output are shown in the following image.

This section describes the eligibility criteria we require from all of our users.

When you register to use our Services (as defined below), we need to make sure that you are able to legally contract with us.

Any use of Company Content, other than as specifically authorized herein, is prohibited and will automatically terminate your rights to use the Services and any Company Content.

All rights to use Company Content that are not expressly granted in this Agreement are reserved by the Company and the Company’s licensors.

I provide the names of the computers and the credentials. $session = New-PSSession -cn $-cred $cred One thing to keep in mind is that at any given time in my domain, there are computers that are offline. Windows Power Shell keeps on creating new sessions in spite of the errors appearing in the console.

You must have an account to comment. Please register or login here!