Partager via


Introduction to Windows PowerShell Cmdlets in Windows 7

New Year, New…console session? Here’s a quick look at creating a new GPO using the Group Policy cmdlets in Windows 7.

To create a new GPO from scratch using PowerShell cmdlets:

 

1. Open an elevated PowerShell console session (1-2 clicks)

2. Command: Import-Module grouppolicy (typing)

3. Command: New-GPO “Sales GPO” (typing)

 (optional: add parameter –starter “Security Starter” )

       Total: 1-2 clicks, 2 lines of typing

To create a new GPO from scratch using the UI:

1. Open the GPMC (1-2 clicks)

2. Navigate to the domain of your target domain (1-2 clicks)

3. Open the Group Policy Objects Folder (1 click)

b. Right click, and select “New” (2 clicks)

or

c. Alternatively, go to Action-> New from the title bar (2 clicks)

4. Enter a name “Sales GPO” (typing)

(Optional: Select a Starter GPO from the Drop Down)

5. Select OK (1 click)

Total: 6-8 clicks, one line of typing

The PowerShell cmdlet example assumes several things:

· The domain that you are logged onto is where you would like to create your new GPO. Otherwise, you can specify the domain you’d like to create the GPO in with the optional –domain parameter (FQDN) and target the DC of your choice with the server parameter.

· GPMC is installed on the machine (Win7 server or Win7 client with RSAT) you are working from

In general, the cmdlet method requires more typing, but far fewer steps and clicks. The additional benefit is the accuracy and ease of repetition: after the initial start up, creating a second GPO is even faster from the PowerShell console. The click-through UI method requires most of the same steps. However, if you capture the cmdlet commands in a script, re-running that script is one command; running that script 100 times is only marginally more effort and assured to produce the same results.

If you don’t have the beta to play around with the Group Policy cmdlets yet, you should check out Darren Mar-Elia’s cmdlets that his company SDMSoftware released. His site, www.gpoguy.com, has helpful videos, articles, and tools to help you work with Group Policy. Check that site out regardless, beta or not. It’s got a lot of good information for every level of GP knowledge.

Comments

  • Anonymous
    January 01, 2003
    To create a new GPO from scratch using PowerShell cmdlets: 1. Open an elevated PowerShell console session 

  • Anonymous
    January 01, 2003
    PingBack from http://www.frickelsoft.net/blog/?p=156

  • Anonymous
    January 01, 2003
    Hello GP Junkies! My name is Bryan Garretson, and I just escaped from the dark cave they keep us Test

  • Anonymous
    January 01, 2003
    Лилия Гутник (Lilia Gutnik) опубликовала ЗДЕСЬ запись с примером коммандлетов групповых политик Windows

  • Anonymous
    January 01, 2003
    You configured a setting in one GPO and want to know what that setting is across all GPO’s. You want

  • Anonymous
    January 01, 2003
    Hey Lionel - Thanks for asking. The PowerShell cmdlets for Group Policy only operate on Domain GPO's, not Local GPO's. -LiliaG, Group Policy PM

  • Anonymous
    January 01, 2003
    Hey tfl and TowerDefense - Do you have the GPMC installed as a feature on your Windows Server 2008 R2 beta machine? Without that, the module will not be found when you type "import-module grouppolicy" at the PowerShell prompt. In order to access the Group Policy PowerShell module, you must have the Windows Server 2008 R2 GPMC. You can get this on your Windows 7 client with the R2 RSAT. LiliaG, Group Policy PM

  • Anonymous
    January 01, 2003
    Does it work for local group policy, outside of a domain?

  • Anonymous
    January 01, 2003
    As tfl say that the module does not exist on my Windows 7 Ulitmate system, or on Windows Server2008 R2 beta 1.

  • Anonymous
    January 01, 2003
    The module does not exist on my Windows 7 Ulitmate system, or on Windows Server2008 R2 beta 1.

  • Anonymous
    January 01, 2003
    Just had a look - the module does not exist on my Windows 7 Ulitmate system, or on Windows Server2008 R2 beta 1.

  • Anonymous
    January 01, 2003
    Лилия Гутник (Lilia Gutnik) опубликовала ЗДЕСЬ запись с примером коммандлетов групповых политик Windows

  • Anonymous
    January 01, 2003
    Lilia Gutnik has posted a blog entry HERE showing an example of the Windows 7 Group Policy cmdlets. 

  • Anonymous
    January 01, 2003
    Just had a look - the module does not exist on my Windows 7 Ulitmate system, or on Windows Server2008 R2 beta 1.