24
POWERSHELL AND GROUPPOLICY Discovering your options

[Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Embed Size (px)

DESCRIPTION

Windows PowerShell is a powerful scripting tool and it is now an essential knowledge for IT administrators. In part 2 of this PowerShell series, we will show you how to use Windows PowerShell to manage Group Policy.

Citation preview

Page 1: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

POWERSHELL AND

GROUPPOLICYDiscovering your options

Page 2: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Welcome

• Kevin Sullivan

[email protected]

– @kevsully67

• Director of Sales Engineering

• Recovering GP MVP, Musician

• Previously Principal Program Manager at Microsoft

• Technology lover – geek dad

WHOAMI

Page 3: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Stream of Consciousness

LET IT FLOW

Page 4: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Agenda – all in the context of Group Policy

• Introduction – PowerShell basics and Group Policy

• Discovering– How do you find what is there?

• Exploring– Navigating around, flying blind

• Learning– Getting help

• Applying– Getting stuff done

LETS GIVE ‘EM SOMETHING TO TALK ABOUT

Page 5: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Introduction

• Getting started with PowerShell - refresher

• Great tools– ISE, Console

– PowerShell Studio

– SDM cmdlets

– More…

• Great resources– Script Center

• Great community– PowerShell.org

– Bingle PowerShell

WHY ARE WE HERE?

Page 6: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Discovering

• Commands

• Modules

• PSSnapIns

• Get-Command

• Get-Help

• Wildcards

HOW TO START?

Page 7: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Exploring

• Get-Command

• Pipe to Measure-Object

– Get-Command |measure-object

• -Verb

• Get-Command –Module GroupPolicy

• Get-Help – ‘Too soon?’

I FOUND A PLACE TO START, NOW WHAT?

Page 8: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Exploring Group Policy

• Group Policy tasks

– Create GPO

– Link GPO

– Delegate GPO

– Backup GPO

• Get-Command

• Measure-Object

STREAM OF CONSCIOUSNESS

Page 9: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

New-GPO, Get-GPO

• Get-help Get-GPO

– Full

– Examples

– ShowWindow

• Filter output

– Where-Object

• Get-help New-GPO

FROM SCRATCH

Page 10: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

New-GPLink, Set-GPLink

• New-GPLink

– GPO

– OU

• Set-GPLink

– Enabled

– Enforced

– Order

NOW WHAT?

Page 11: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Get-GPInheritance

• Prompt

• Mandatory Parameters

• Command Pane/command window

• Show-Command

• Expose buried data

WHO IS AFFECTED?

Page 12: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Get-GPPermissions, Set-GPPermissions

• GP Delegation Primer

• Parameter sets

• Custom Delegation

TARGET THE RIGHT PEOPLE

Page 13: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Backup-GPO(s), Restore

• Have directory for backups

• Store all backups together

• Locating backups by name, GUID etc.

– All referenced in manifest.xml

• Restore by…

– BackupID

– GUID

– Name

SAVE YOUR WORK!

Page 14: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

TROUBLESHOOTING GPEvents

Page 15: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

GP Start/Stop Events

• Event ‘bookends’– Computer Start

• Start Event = 4000

• End Event = 6000 (warning), 7000 (error) or 8000 (Success)

– User Logon

• Start Event = 4001

• End Event = 6001, 7001, 8001

– Computer Manual Refresh

• Start Event = 4004

• End Event = 6004, 7004, 8004

GP EVENTS

Page 16: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Get-WinEvent, Get-EventLog

• Troubleshooting GP– GP LogView

– ActivityIDs

– SDM Software

• Find Group Policy Events

• Find Activity ID– Activity ID is a GUID that correlates all events fired during

a single GP Processing Cycle

– Get-WinEvent “Microsoft-Windows-

GroupPolicy/Operational” –FilterXPath

“Event[System/EventID=‘4000’]”

WHAT HAPPENED DURING GPUPDATE?

Page 17: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Command History

• Get-History

• Invoke-History

• Clear-History

• Add-History

WHAT HAVE I DONE?

Page 18: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Get-GPResultantSetOfPolicy

• HTML / XML

• GP Refresh

• GP Health

• Online content

• Lots of fun!

Page 19: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Wrap-up

• Questions

• Next month?

• Send feedback

[email protected]

WHAT DOES THE FUTURE BRING?

Page 20: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

SDM Software

• Darren Mar-Elia – GPOGuy

– GP MVP

• Free GP cmdlets

– Fill some gaps in native MS cmdlets

• Blog

– Http://sdmsoftware.com/group-policy-blog

WHATS NEXT?

Page 21: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Helpful Stuff

• GP Events - http://technet.microsoft.com/en-us/library/cc749336(v=WS.10).aspx

• SDM Software – http://sdmsoftware.com

– Darren Mar-Elia GP MVP

• GP PowerShell cmdlets -http://technet.microsoft.com/en-us/library/ee461027.aspx

RESOURCES

Page 22: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Resources• Learn PowerShell in a Month of Lunches – Don Jones

@concentrateddon, Jeffery Hicks @jeffHicks

• Learn PowerShell Tool Making in a Month of Lunches –Don Jones, Jeffery Hicks

• Follow– Jeffery Snover @jsnover

– MSFT Scripting Guys @scriptingGuys

– June Blender @juneb_get_help

– Lee Holmes @lee_holmes

– /r/powershell @r_powershell

– PowerShell Tips @powerTip

– PowerShell.org @PSHOrg

LOTS OF RESOURCES

Page 23: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

Resources• http://www.powershellpro.com

– Some great tutorials

• http://powershell.org

• http://technet.Microsoft.com/scriptcenter

– Repository!

• http://jdhitsolutions.com/blog

– Jeff Hicks

• PowerShell help system!

• http://www.specopssoft.com

• http://success.specopssoft.com

LOTS OF RESOURCES

Page 24: [Webinar] PowerShell Series 2 - Using PowerShell to manage Group Policy

ideas

• Backup-gpo

– Backup WMI filters

• Get-GPInheritance

– OS/app deploy needing to find links

• Authenticated users permissions to gp

– Get-gppermission(s)

• Site to zone mapping

– Set-gpregistryvalue