{"id":2794,"date":"2013-02-13T09:52:29","date_gmt":"2013-02-13T14:52:29","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=2794"},"modified":"2013-06-28T12:59:25","modified_gmt":"2013-06-28T16:59:25","slug":"set-gpo-status-with-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/","title":{"rendered":"Set GPO Status with PowerShell"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble-150x150.png\" alt=\"talkbubble\" width=\"150\" height=\"150\" class=\"alignleft size-thumbnail wp-image-1688\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble-150x150.png 150w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble-198x198.png 198w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>Last week I dropped in on a class <a href=\"http:\/\/www.gpanswers.com\/training\/get-training\/\" title=\"check out Jeremy's classes\" target=\"_blank\">Jeremy Moskowitz<\/a> was teaching on Group Policy to talk a little PowerShell. I was demonstrating the Get-GPO cmdlet and talking about the object you get back and how you can use it to filter and create reports. One of the attendees asked about changing the status. <\/p>\n<p>What he was referring to was the status that indicates if all settings are disabled, or if the user\/computer side of a GPO is disabled. Here's an example of what you see using Get-GPO from the GroupPolicy module.<\/p>\n<pre class=\"lang:ps decode:true \" >PS C:\\&gt; Import-Module GroupPolicy\r\nPS C:\\&gt; get-gpo \"script test\"\r\n\r\nDisplayName      : Script Test\r\nDomainName       : GLOBOMANTICS.local\r\nOwner            : GLOBOMANTICS\\Domain Admins\r\nId               : 21c79adb-9f4d-48e1-8329-4e8a81cd017a\r\nGpoStatus        : AllSettingsDisabled\r\nDescription      : sample policy for script processing\r\nCreationTime     : 9\/28\/2011 9:32:40 PM\r\nModificationTime : 2\/12\/2013 11:07:52 AM\r\nUserVersion      : AD Version: 2, SysVol Version: 2\r\nComputerVersion  : AD Version: 0, SysVol Version: 0\r\nWmiFilter        :\r\n<\/pre>\n<p>The setting in question is GpoStatus which as you can see here indicates that all settings are disabled on this particular GPO. In the graphical Group Policy Management console, you can manually adjust this setting. But in Group Policy there are no cmdlets for setting any values. I don't know why I didn't have an answer that night but it turns out to be surprisingly simple yet unexpected.<\/p>\n<p>It turns out you can assign a new value directly on the object.<\/p>\n<pre class=\"lang:ps decode:true \" >PS C:\\&gt; $gpo = get-gpo \"script test\"\r\nPS C:\\&gt; $gpo.GpoStatus\r\nAllSettingsDisabled\r\nPS C:\\&gt; $gpo.GpoStatus=\"AllSettingsEnabled\"\r\nPS C:\\&gt; $gpo.GpoStatus\r\nAllSettingsEnabled\r\nPS C:\\&gt;\r\n<\/pre>\n<p>Valid values are AllSettingsEnabled, AllSettingsDisabled, UserSettingsDisabled and ComputerSettingsDisabled. The surprising part is that the change is immediate and written back to Active Directory. There's no need to \"set\" or \"put\" anything. I can verify by retrieving the GPO again.<\/p>\n<pre class=\"lang:ps decode:true \" >PS C:\\&gt; get-gpo \"script test\"\r\n\r\nDisplayName      : Script Test\r\nDomainName       : GLOBOMANTICS.local\r\nOwner            : GLOBOMANTICS\\Domain Admins\r\nId               : 21c79adb-9f4d-48e1-8329-4e8a81cd017a\r\nGpoStatus        : AllSettingsEnabled\r\nDescription      : sample policy for script processing\r\nCreationTime     : 9\/28\/2011 9:32:40 PM\r\nModificationTime : 2\/13\/2013 9:21:18 AM\r\nUserVersion      : AD Version: 2, SysVol Version: 2\r\nComputerVersion  : AD Version: 0, SysVol Version: 0\r\nWmiFilter        :\r\n<\/pre>\n<p>This makes for some convenient one-liners:<\/p>\n<pre class=\"lang:ps decode:true \" >(get-gpo \"script test\").gpostatus=\"ComputerSettingsDisabled\"\r\n<\/pre>\n<p>For quick and dirty work, that is pretty handy. But you know me, I like reusable tools. There are a few drawbacks to this. First, you have to remember the valid settings. There's also no way to double-check you are changing the right GPO, ie no -WhatIf. So I put together a function called Set-GPOStatus.<\/p>\n<pre class=\"lang:ps decode:true \" >Function Set-GPOStatus {\r\n\r\n&lt;# comment based help is here #&gt;\r\n\r\n[cmdletbinding(SupportsShouldProcess)]\r\n\r\nParam(\r\n[Parameter(Position=0,Mandatory=$True,HelpMessage=\"Enter the name of a GPO\",\r\nValueFromPipeline,ValueFromPipelinebyPropertyName)]\r\n[Alias(\"name\")]\r\n[ValidateNotNullorEmpty()]\r\n[Parameter(ParameterSetName=\"EnableAll\")]\r\n[Parameter(ParameterSetName=\"DisableAll\")]\r\n[Parameter(ParameterSetName=\"DisableUser\")]\r\n[Parameter(ParameterSetName=\"DisableComputer\")]\r\n[object]$DisplayName,\r\n[Parameter(ParameterSetName=\"EnableAll\")]\r\n[Parameter(ParameterSetName=\"DisableAll\")]\r\n[Parameter(ParameterSetName=\"DisableUser\")]\r\n[Parameter(ParameterSetName=\"DisableComputer\")]\r\n[string]$Domain,\r\n[Parameter(ParameterSetName=\"EnableAll\")]\r\n[Parameter(ParameterSetName=\"DisableAll\")]\r\n[Parameter(ParameterSetName=\"DisableUser\")]\r\n[Parameter(ParameterSetName=\"DisableComputer\")]\r\n[string]$Server,\r\n[Parameter(ParameterSetName=\"EnableAll\")]\r\n[switch]$EnableAll,\r\n[Parameter(ParameterSetName=\"DisableAll\")]\r\n[switch]$DisableAll,\r\n[Parameter(ParameterSetName=\"DisableUser\")]\r\n[switch]$DisableUser,\r\n[Parameter(ParameterSetName=\"DisableComputer\")]\r\n[switch]$DisableComputer,\r\n[Parameter(ParameterSetName=\"EnableAll\")]\r\n[Parameter(ParameterSetName=\"DisableAll\")]\r\n[Parameter(ParameterSetName=\"DisableUser\")]\r\n[Parameter(ParameterSetName=\"DisableComputer\")]\r\n[switch]$Passthru\r\n)\r\n\r\nBegin {\r\n    Write-Verbose -Message \"Starting $($MyInvocation.Mycommand)\"  \r\n       \r\n    #define a hashtable we can for splatting\r\n    $paramhash=@{ErrorAction=\"Stop\"}\r\n    if ($domain) { $paramhash.Add(\"Domain\",$Domain) }\r\n    if ($server) { $paramhash.Add(\"Server\",$Server) }\r\n\r\n} #begin\r\n\r\nProcess {\r\n    #define appropriate GPO setting value depending on parameter\r\n    Switch ($PSCmdlet.ParameterSetName) {\r\n    \"EnableAll\" { $status = \"AllSettingsEnabled\" }\r\n    \"DisableAll\" { $status = \"AllSettingsDisabled\" }\r\n    \"DisableUser\" { $status = \"UserSettingsEnabled\" }\r\n    \"DisableComputer\" { $status = \"ComputerSettingsEnabled\" }\r\n    default {\r\n            Write-Warning \"You didn't specify a GPO setting. No changes will be made.\"\r\n            Return\r\n            }\r\n    }\r\n    \r\n    #if GPO is a string, get it with Get-GPO\r\n    if ($Displayname -is [string]) {\r\n        $paramhash.Add(\"name\",$DisplayName)\r\n        \r\n        Write-Verbose \"Retrieving Group Policy Object\"\r\n        Try {\r\n            write-verbose \"Using Parameter hash $($paramhash | out-string)\"\r\n            $gpo=Get-GPO @paramhash\r\n        }\r\n        Catch {\r\n            Write-Warning \"Failed to find a GPO called $displayname\"\r\n            Return\r\n        }\r\n    }\r\n    else {\r\n        $paramhash.Add(\"GUID\",$DisplayName.id)\r\n        $gpo = $DisplayName\r\n    }\r\n\r\n    #set the GPOStatus property on the GPO object to the correct value. The change is immediate.\r\n    Write-Verbose \"Setting GPO $($gpo.displayname) status to $status\"\r\n\r\n    if ($PSCmdlet.ShouldProcess(\"$($gpo.Displayname) : $status \")) {\r\n        $gpo.gpostatus=$status\r\n        if ($passthru) {\r\n            #refresh the GPO Object\r\n            write-verbose \"Using Parameter hash $($paramhash | out-string)\"\r\n            get-gpo @paramhash \r\n        }\r\n    } #should process\r\n\r\n} #process\r\n\r\nEnd {\r\n    Write-Verbose -Message \"Ending $($MyInvocation.Mycommand)\"\r\n} #end\r\n\r\n} #end Set-GPOStatus\r\n<\/pre>\n<p>The function takes either a GPO name or you can pipe a GPO into it. I then turned all of the settings into switches that are (I hope) a little more user-friendly. This command also supports ShouldProcess which gives me -WhatIf.<\/p>\n<pre class=\"lang:ps decode:true \" >if ($PSCmdlet.ShouldProcess(\"$($gpo.Displayname) : $status \")) {\r\n        $gpo.gpostatus=$status\r\n        if ($passthru) {\r\n            #refresh the GPO Object\r\n            write-verbose \"Using Parameter hash $($paramhash | out-string)\"\r\n            get-gpo @paramhash \r\n        }\r\n} #should process\r\n<\/pre>\n<p>Now I can use the command like this.<\/p>\n<pre class=\"lang:ps decode:true \" >PS C:\\&gt; set-gpostatus \"Script Test\" -DisableAll -WhatIf\r\nWhat if: Performing operation \"Set-GPOStatus\" on Target \"Script Test : AllSettingsDisabled \".\r\n<\/pre>\n<p>The other key element in the function is the use of multiple parameter sets. I wanted each status option to be its own parameter set. Yet some parameters like GPO name, domain and server apply to all of them. In those situations all you need to do is specify all of the parameter sets you want a parameter to belong to. But I need to point out that in this particular function I'm bending the rules a little. Normally, if you don't specify a parameter set then the parameter automatically belongs to all parameter sets. That generally works out because you can define a default parameter set name in the cmdletbinding tag. However I'm not doing that here because I didn't want to make an assumption about what setting to use. So I explicitly define the parameter sets and have some error handling in a Switch statement to test the parameter set name and bail out if no setting switches were used. So don't take this as a perfect example, but know that if you have a parameter that you want to belong to more than one parameter set, simply add the set name.<\/p>\n<p>Even though it isn't difficult in an interactive console to change the GPO status property, by creating a tool I've introduced some new functionality and now have something I can incorporate into any of my Group Policy management scripts.<\/p>\n<p>Download <a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/Set-GPOStatus.txt\" target='_blank'>Set-GPOStatus<\/a> and let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I dropped in on a class Jeremy Moskowitz was teaching on Group Policy to talk a little PowerShell. I was demonstrating the Get-GPO cmdlet and talking about the object you get back and how you can use it to filter and create reports. One of the attendees asked about changing the status. What&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[287,4],"tags":[290,570,534],"class_list":["post-2794","post","type-post","status-publish","format-standard","hentry","category-group-policy","category-powershell","tag-gpo","tag-group-policy","tag-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Set GPO Status with PowerShell &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Set GPO Status with PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Last week I dropped in on a class Jeremy Moskowitz was teaching on Group Policy to talk a little PowerShell. I was demonstrating the Get-GPO cmdlet and talking about the object you get back and how you can use it to filter and create reports. One of the attendees asked about changing the status. What...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2013-02-13T14:52:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-06-28T16:59:25+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble-150x150.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Set GPO Status with PowerShell\",\"datePublished\":\"2013-02-13T14:52:29+00:00\",\"dateModified\":\"2013-06-28T16:59:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/\"},\"wordCount\":582,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/10\\\/talkbubble-150x150.png\",\"keywords\":[\"GPO\",\"Group Policy\",\"PowerShell\"],\"articleSection\":[\"Group Policy\",\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/\",\"name\":\"Set GPO Status with PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/10\\\/talkbubble-150x150.png\",\"datePublished\":\"2013-02-13T14:52:29+00:00\",\"dateModified\":\"2013-06-28T16:59:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/10\\\/talkbubble.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/10\\\/talkbubble.png\",\"width\":\"198\",\"height\":\"208\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2794\\\/set-gpo-status-with-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Group Policy\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/group-policy\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Set GPO Status with PowerShell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Set GPO Status with PowerShell &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Set GPO Status with PowerShell &#8226; The Lonely Administrator","og_description":"Last week I dropped in on a class Jeremy Moskowitz was teaching on Group Policy to talk a little PowerShell. I was demonstrating the Get-GPO cmdlet and talking about the object you get back and how you can use it to filter and create reports. One of the attendees asked about changing the status. What...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2013-02-13T14:52:29+00:00","article_modified_time":"2013-06-28T16:59:25+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble-150x150.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Set GPO Status with PowerShell","datePublished":"2013-02-13T14:52:29+00:00","dateModified":"2013-06-28T16:59:25+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/"},"wordCount":582,"commentCount":1,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble-150x150.png","keywords":["GPO","Group Policy","PowerShell"],"articleSection":["Group Policy","PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/","name":"Set GPO Status with PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble-150x150.png","datePublished":"2013-02-13T14:52:29+00:00","dateModified":"2013-06-28T16:59:25+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png","width":"198","height":"208"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Group Policy","item":"https:\/\/jdhitsolutions.com\/blog\/category\/group-policy\/"},{"@type":"ListItem","position":2,"name":"Set GPO Status with PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1460,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/","url_meta":{"origin":2794,"position":0},"title":"Get GPO Backup","author":"Jeffery Hicks","date":"May 24, 2011","format":false,"excerpt":"The GroupPolicy module from Microsoft offers a great deal of functionality from a command line. In terms of regular maintenance or administration it is pretty hard to beat, especially if you have 100s or 1000s of GPOs. When you have such a large number, backing them up is critical and\u2026","rel":"","context":"In &quot;Group Policy&quot;","block_context":{"text":"Group Policy","link":"https:\/\/jdhitsolutions.com\/blog\/category\/group-policy\/"},"img":{"alt_text":"get-gpobackp help","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup-300x204.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":8041,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8041\/get-group-policy-links-with-powershell\/","url_meta":{"origin":2794,"position":1},"title":"Get Group Policy Links with PowerShell","author":"Jeffery Hicks","date":"January 18, 2021","format":false,"excerpt":"I was chatting with my friend Gladys Kravitz about Group Policy reporting stuff recently,. and the discussion led me to dust off some old code I had for getting Group Policy links using PowerShell. The GroupPolicy module has a Set-GPLink command, but nothing that easily shows you what GPOs are\u2026","rel":"","context":"In &quot;Active Directory&quot;","block_context":{"text":"Active Directory","link":"https:\/\/jdhitsolutions.com\/blog\/category\/active-directory\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-gpinherticance-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-gpinherticance-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-gpinherticance-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-gpinherticance-1.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-gpinherticance-1.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":2356,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2356\/group-policy-analysis-and-reporting-with-powershell\/","url_meta":{"origin":2794,"position":2},"title":"Group Policy Analysis and Reporting with PowerShell","author":"Jeffery Hicks","date":"May 31, 2012","format":false,"excerpt":"In a few weeks I'll be presenting at TechEd North America. I hope you already made plans to go because it is sold-out. On Wednesday, June 13th at 8:30AM I'll be talking about Group Policy and PowerShell; specifically Group Policy Analysis and Reporting with PowerShell. This should be a lot\u2026","rel":"","context":"In &quot;Conferences&quot;","block_context":{"text":"Conferences","link":"https:\/\/jdhitsolutions.com\/blog\/category\/conferences\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/05\/TENA2012_Spread-The-Word_Badge_BLUE_attending_250-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":347,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/347\/winrm-domain-or-workgroup\/","url_meta":{"origin":2794,"position":3},"title":"WinRM: Domain or Workgroup?","author":"Jeffery Hicks","date":"September 11, 2009","format":false,"excerpt":"I'm curious about something and would like to hear from you. PowerShell v2 remoting uses WinRM which in a domain environment is very secure and easy to use. You can even use a GPO to configure your domain members. However you can also use WinRM in a workgroup environment but\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":817,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/817\/module-mania\/","url_meta":{"origin":2794,"position":4},"title":"Module Mania","author":"Jeffery Hicks","date":"August 12, 2010","format":false,"excerpt":"More and more, you're seeing members of the Windows PowerShell community package their contributions into modules, myself included. Although you'll probably still see a lot of individual functions because it is often easier to demonstrate or educate. I received a comment on my Weather module that I thought merited a\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/get-command-module-300x224.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1448,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/1448\/teched-atlanta-troubleshooting-with-rsop\/","url_meta":{"origin":2794,"position":5},"title":"TechEd Atlanta &#8211; Troubleshooting with RSoP","author":"Jeffery Hicks","date":"May 23, 2011","format":false,"excerpt":"I thought my session on troubleshooting with Group Policy and Resultant Set of Policy (RSoP) went rather well. I got some great questions and some nice feedback. The session was recorded and you can watch it on the TechEd North America site, even if you didn't attend. Click here for\u2026","rel":"","context":"In &quot;Conferences&quot;","block_context":{"text":"Conferences","link":"https:\/\/jdhitsolutions.com\/blog\/category\/conferences\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2794"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2794\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}