{"id":1460,"date":"2011-05-24T08:33:45","date_gmt":"2011-05-24T12:33:45","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1460"},"modified":"2015-03-11T17:31:01","modified_gmt":"2015-03-11T21:31:01","slug":"get-gpo-backup","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/","title":{"rendered":"Get GPO Backup"},"content":{"rendered":"<p>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 easy to accomplish with the Backup-GPO cmdlet. However, if you want to restore or import from a backup, you have to resort to the graphical Group Policy Managment Console. I couldn't find any way to manage GPO backups from PowerShell so I wrote my own.<\/p>\n<p>My function, Get-GPOBackup, will search a GPO backup folder and retrieve backup objects. All of this is done using the file system. Technically you don't need the Group Policy module to retrieve the backup information. However, if you want to restore anything then you of course need the Group Policy module loaded. The only parameter you need to specify is the path. Although the function is designed to use the value of a global variable, $GPBackupPath. So if you use this alot, set that variable. But perhaps before we get too far you'd like to see the function.<\/p>\n<pre class=\"lang:ps decode:true \" >Function Get-GPOBackup {\r\n\r\n[cmdletbinding()]\r\n\r\nParam(\r\n[Parameter(Position=0,Mandatory=$False,HelpMessage=\"What is the path to the GPO backup folder?\")]\r\n[ValidateNotNullOrEmpty()]\r\n[string]$Path=$global:GPBackupPath,\r\n[Parameter(Position=1)]\r\n[string]$Name,\r\n[switch]$Latest\r\n)\r\n\r\n#validate $Path\r\nif (-Not $Path) {\r\n$Path=Read-Host \"What is the path to the GPO backup folder?\"\r\n}\r\n\r\nTry\r\n{\r\nWrite-Verbose \"Validating $Path\"\r\nif (-Not (Test-Path $Path)) { Throw }\r\n}\r\nCatch\r\n{\r\nWrite-Warning \"Failed to find $Path\"\r\nBreak\r\n}\r\n\r\n#get each folder that looks like a GUID\r\n[regex]$regex=\"^(\\{){0,1}[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}(\\}){0,1}$\"\r\n\r\nWrite-Verbose \"Enumerating folders under $Path\"\r\n\r\n#define an array to hold each backup object\r\n$Backups=@()\r\n\r\n#find all folders named with a GUID\r\nGet-ChildItem -Path $path | Where {$_.name -Match $regex -AND $_.PSIsContainer} |\r\nforeach {\r\n\r\n#import the Bkupinfo.xml file\r\n$file=Join-Path $_.FullName -ChildPath \"bkUpinfo.xml\"\r\nWrite-Verbose \"Importing $file\"\r\n[xml]$data=Get-Content -Path $file\r\n\r\n#parse the xml file for data\r\n$GPO=$data.BackupInst.GPODisplayName.\"#cdata-section\"\r\n$GPOGuid=$data.BackupInst.GPOGuid.\"#cdata-section\"\r\n$ID=$data.BackupInst.ID.\"#cdata-section\"\r\n$Comment=$data.BackupInst.comment.\"#cdata-section\"\r\n#convert backup time to a date time object\r\n[datetime]$Backup=$data.BackupInst.BackupTime.\"#cdata-section\"\r\n$Domain=$data.BackupInst.GPODomain.\"#cdata-section\"\r\n\r\n#write a custom object to the pipeline\r\n$Backups+=New-Object -TypeName PSObject -Property @{\r\nName=$GPO\r\nComment=$Comment\r\n#strip off the {} from the Backup ID GUID\r\nBackupID=$ID.Replace(\"{\",\"\").Replace(\"}\",\"\")\r\n#strip off the {} from the GPO GUID\r\nGuid=$GPOGuid.Replace(\"{\",\"\").Replace(\"}\",\"\")\r\nBackup=$Backup\r\nDomain=$Domain\r\nPath=$Path\r\n}\r\n\r\n} #foreach\r\n\r\n#if searching by GPO name, then filter and get just those GPOs\r\nif ($Name)\r\n{\r\nWrite-Verbose \"Filtering for GPO: $Name\"\r\n$Backups=$Backups | where {$_.Name -like $Name}\r\n\r\n}\r\n\r\nWrite-Verbose \"Found $($Backups.Count) GPO Backups\"\r\n\r\n#if -Latest then only write out the most current version of each GPO\r\nif ($Latest)\r\n{\r\nWrite-Verbose \"Getting Latest Backups\"\r\n$grouped=$Backups | Sort-Object -Property GUID | Group-Object -Property GUID\r\n$grouped | Foreach {\r\n$_.Group | Sort-Object -Property Backup | Select-Object -Last 1\r\n}\r\n}\r\nelse\r\n{\r\n$Backups\r\n}\r\n\r\nWrite-Verbose \"Ending function\"\r\n\r\n} #end function<\/pre>\n<p>The complete function has comment based help.<\/p>\n<figure id=\"attachment_1464\" aria-describedby=\"caption-attachment-1464\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1464\" title=\"get-gpobackup\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup-300x204.png\" alt=\"get-gpobackp help\" width=\"300\" height=\"204\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup-300x204.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup-1024x698.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup.png 1038w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1464\" class=\"wp-caption-text\">get-gpobackp help<\/figcaption><\/figure>\n<p>As I said, the -Path parameter is key. It is not mandatory in the attribute-sense, but I have code that prompts for a missing value and the path is tested before anything else is done.<\/p>\n<pre class=\"lang:ps decode:true \" >#validate $Path\r\nif (-Not $Path) {\r\n$Path=Read-Host \"What is the path to the GPO backup folder?\"\r\n}\r\n\r\nTry\r\n{\r\nWrite-Verbose \"Validating $Path\"\r\nif (-Not (Test-Path $Path)) { Throw }\r\n}\r\nCatch\r\n{\r\nWrite-Warning \"Failed to find $Path\"\r\nBreak\r\n}\r\n<\/pre>\n<p>GPO backups are stored under a GUID for each GPO, so I use a regular expression pattern to identify these. I'm making an assumption that the path you specify won't have any other folders with GUID-based names.<\/p>\n<pre class=\"lang:ps decode:true \" >#get each folder that looks like a GUID\r\n[regex]$regex=\"^(\\{){0,1}[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}(\\}){0,1}$\"<\/pre>\n<p>Each backup consists of a few XML files. My function parses the XML and creates a custom object for each backup. These are added to a temporary array.<\/p>\n<pre class=\"lang:ps decode:true \" >#define an array to hold each backup object\r\n$Backups=@()\r\n\r\n#find all folders named with a GUID\r\nGet-ChildItem -Path $path | Where {$_.name -Match $regex -AND $_.PSIsContainer} |\r\nforeach {\r\n\r\n#import the Bkupinfo.xml file\r\n$file=Join-Path $_.FullName -ChildPath \"bkUpinfo.xml\"\r\nWrite-Verbose \"Importing $file\"\r\n[xml]$data=Get-Content -Path $file\r\n\r\n#parse the xml file for data\r\n$GPO=$data.BackupInst.GPODisplayName.\"#cdata-section\"\r\n$GPOGuid=$data.BackupInst.GPOGuid.\"#cdata-section\"\r\n$ID=$data.BackupInst.ID.\"#cdata-section\"\r\n$Comment=$data.BackupInst.comment.\"#cdata-section\"\r\n#convert backup time to a date time object\r\n[datetime]$Backup=$data.BackupInst.BackupTime.\"#cdata-section\"\r\n$Domain=$data.BackupInst.GPODomain.\"#cdata-section\"\r\n\r\n#write a custom object to the pipeline and add to the temporary array\r\n$Backups+=New-Object -TypeName PSObject -Property @{\r\nName=$GPO\r\nComment=$Comment\r\n#strip off the {} from the Backup ID GUID\r\nBackupID=$ID.Replace(\"{\",\"\").Replace(\"}\",\"\")\r\n#strip off the {} from the GPO GUID\r\nGuid=$GPOGuid.Replace(\"{\",\"\").Replace(\"}\",\"\")\r\nBackup=$Backup\r\nDomain=$Domain\r\nPath=$Path\r\n}\r\n} #foreach\r\n<\/pre>\n<p>Now for the really fun part. The function supports a few other parameters that allow you to search for a GPO by name. So if you specify -Name, everything else is filtered out.<\/p>\n<pre class=\"lang:ps decode:true \" >#if searching by GPO name, then filter and get just those GPOs\r\nif ($Name)\r\n{\r\nWrite-Verbose \"Filtering for GPO: $Name\"\r\n$Backups=$Backups | where {$_.Name -like $Name}\r\n\r\n}\r\n<\/pre>\n<p>I also include a parameter to get the latest backup. I accomplish this by grouping the backup objects by their GPO GUID, sorting by backup date and selecting the latest one.<\/p>\n<pre class=\"lang:ps decode:true \" >#if -Latest then only write out the most current version of each GPO\r\nif ($Latest)\r\n{\r\nWrite-Verbose \"Getting Latest Backups\"\r\n$grouped=$Backups | Sort-Object -Property GUID | Group-Object -Property GUID\r\n$grouped | Foreach {\r\n$_.Group | Sort-Object -Property Backup | Select-Object -Last 1\r\n}\r\n}<\/pre>\n<p>You should end up with an object like this for each GPO backup.<\/p>\n<pre class=\"lang:batch decode:true \" >Backup : 5\/2\/2011 8:10:13 PM\r\nName : WinRM Configuration\r\nBackupID : 5AAFD6DF-24C0-40EF-9DF1-AC9C279E010B\r\nPath : \\\\server01\\backup\\gpo\r\nDomain : jdhlab.local\r\nGuid : 38228a9f-f2ec-4b48-8829-4f3131e4f77c\r\nComment : second backup<\/pre>\n<p>I tried to create an object so that if you wanted to restore a GPO you could with minimal effort. Unfortunately, the Import-GPO cmdlet doesn't have enough support for parameter binding. So if you want to restore a backup, you'll need to resort to a ForEach-Object command like this:<\/p>\n<pre class=\"lang:batch decode:true \" >PS C:\\&amp;gt; Get-GPOBackup \\\\coredc01\\backup\\gpo -name \"Ex*Laptop\" -latest | foreach {Import-GPO -TargetGuid $_.Guid -backupid $_.backupID -path $_.path}\r\n\r\nDisplayName : Executive Laptop\r\nDomainName : jdhlab.local\r\nOwner : JDHLAB\\Domain Admins\r\nId : af6f4a88-5e8a-49ce-84f7-f04677a7d80d\r\nGpoStatus : AllSettingsEnabled\r\nDescription : configure C-level laptops\r\nCreationTime : 9\/8\/2010 8:36:10 AM\r\nModificationTime : 5\/23\/2011 9:52:43 AM\r\nUserVersion : AD Version: 2, SysVol Version: 2\r\nComputerVersion : AD Version: 9, SysVol Version: 9\r\nWmiFilter :<\/pre>\n<p>My function is in a stand-alone script so to use it, you either need to copy and paste the function into your profile or dot source the script. Even though I wrote it to help with imports, you could easily use it to manage a backup folder, deleting obsolete backups. The function is writing an object to the pipeline that you can use in whatever manner you can think of. I hope you'll let me know what you think and if there is anything you think is missing.<\/p>\n<p>Download <a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/Get-GPOBackup.txt\">Get-GPOBackup<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 easy to accomplish with the&#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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[287,4,8],"tags":[201,290,288,534,540,206],"class_list":["post-1460","post","type-post","status-publish","format-standard","hentry","category-group-policy","category-powershell","category-scripting","tag-backup","tag-gpo","tag-grouppolicy","tag-powershell","tag-scripting","tag-xml"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Get GPO Backup &#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\/1460\/get-gpo-backup\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get GPO Backup &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"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 easy to accomplish with the...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-05-24T12:33:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-03-11T21:31:01+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup-300x204.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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Get GPO Backup\",\"datePublished\":\"2011-05-24T12:33:45+00:00\",\"dateModified\":\"2015-03-11T21:31:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/\"},\"wordCount\":536,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/05\\\/get-gpobackup-300x204.png\",\"keywords\":[\"Backup\",\"GPO\",\"GroupPolicy\",\"PowerShell\",\"Scripting\",\"xml\"],\"articleSection\":[\"Group Policy\",\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/\",\"name\":\"Get GPO Backup &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/05\\\/get-gpobackup-300x204.png\",\"datePublished\":\"2011-05-24T12:33:45+00:00\",\"dateModified\":\"2015-03-11T21:31:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/05\\\/get-gpobackup.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/05\\\/get-gpobackup.png\",\"width\":\"1038\",\"height\":\"708\",\"caption\":\"get-gpobackp help\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1460\\\/get-gpo-backup\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Group Policy\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/group-policy\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get GPO Backup\"}]},{\"@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":"Get GPO Backup &#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\/1460\/get-gpo-backup\/","og_locale":"en_US","og_type":"article","og_title":"Get GPO Backup &#8226; The Lonely Administrator","og_description":"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 easy to accomplish with the...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-05-24T12:33:45+00:00","article_modified_time":"2015-03-11T21:31:01+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup-300x204.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Get GPO Backup","datePublished":"2011-05-24T12:33:45+00:00","dateModified":"2015-03-11T21:31:01+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/"},"wordCount":536,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup-300x204.png","keywords":["Backup","GPO","GroupPolicy","PowerShell","Scripting","xml"],"articleSection":["Group Policy","PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/","name":"Get GPO Backup &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup-300x204.png","datePublished":"2011-05-24T12:33:45+00:00","dateModified":"2015-03-11T21:31:01+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/get-gpobackup.png","width":"1038","height":"708","caption":"get-gpobackp help"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1460\/get-gpo-backup\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Group Policy","item":"https:\/\/jdhitsolutions.com\/blog\/category\/group-policy\/"},{"@type":"ListItem","position":2,"name":"Get GPO Backup"}]},{"@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":2794,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2794\/set-gpo-status-with-powershell\/","url_meta":{"origin":1460,"position":0},"title":"Set GPO Status with PowerShell","author":"Jeffery Hicks","date":"February 13, 2013","format":false,"excerpt":"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\u2026","rel":"","context":"In &quot;Group Policy&quot;","block_context":{"text":"Group Policy","link":"https:\/\/jdhitsolutions.com\/blog\/category\/group-policy\/"},"img":{"alt_text":"talkbubble","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble-150x150.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":1460,"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":347,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/347\/winrm-domain-or-workgroup\/","url_meta":{"origin":1460,"position":2},"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":2356,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2356\/group-policy-analysis-and-reporting-with-powershell\/","url_meta":{"origin":1460,"position":3},"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":7081,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7081\/managing-my-powershell-backup-files\/","url_meta":{"origin":1460,"position":4},"title":"Managing My PowerShell Backup Files","author":"Jeffery Hicks","date":"December 12, 2019","format":false,"excerpt":"Last month I started a project to begin backing up critical folders. This backup process is nothing more than another restore option should I need it. Still, it has been running for over a month and I now have a number of full backup files. I don't need to keep\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-18.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-18.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-18.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-18.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":6996,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6996\/powershell-controller-scripts\/","url_meta":{"origin":1460,"position":5},"title":"PowerShell Controller Scripts","author":"Jeffery Hicks","date":"November 26, 2019","format":false,"excerpt":"When it comes to PowerShell scripting we tend to focus a lot on functions and modules. We place an emphasis on building re-usable tools. The idea is that we can then use these tools at a PowerShell prompt to achieve a given task. More than likely, these tasks are repetitive.\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-21.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-21.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-21.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/11\/image_thumb-21.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1460","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=1460"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1460\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}