locked
Unable to backup selected GPO RRS feed

  • Question

  • Hi All,

    Does anyone know how to back up a selection of GPOs. I understand that we are able to select the whole range of GPO's and single GPO's under the GPO container but we are unable to click and select more than one at a time.

    I do not want to backup all the GPO's under the GPO container because not all belong to my site.

    Any help would be greatly appreciated.

    Regards.

    Peter.


    Peter Flint

    Tuesday, September 15, 2020 6:31 AM

Answers

  • Quickest option is probably to back them all up, then delete the ones you don't want to keep if its a one time thing?

    or (untested, but should work)

    $gpos = get-gpo -all
    $onesiwant = $gpos | where {$_.DisplayName -match "Thisismygpo-"}

    foreach ($gpo in $onesiwant)
    {
    Backup-GPO -Guid ($gpo.id) -Path "c:\randompath\" -
    }
    • Marked as answer by czql5v Tuesday, September 15, 2020 8:29 AM
    Tuesday, September 15, 2020 7:15 AM
  • $onesiwant = $gpos | where {$_.DisplayName -match "Thisismygpo-"}

    That's a filter. Filter by name (ie matching country code) and then the foreach loop will backup ones matching your filter. Not all of them.

    Q

    • Marked as answer by czql5v Tuesday, September 15, 2020 1:09 PM
    Tuesday, September 15, 2020 9:04 AM

All replies

  • Quickest option is probably to back them all up, then delete the ones you don't want to keep if its a one time thing?

    or (untested, but should work)

    $gpos = get-gpo -all
    $onesiwant = $gpos | where {$_.DisplayName -match "Thisismygpo-"}

    foreach ($gpo in $onesiwant)
    {
    Backup-GPO -Guid ($gpo.id) -Path "c:\randompath\" -
    }
    • Marked as answer by czql5v Tuesday, September 15, 2020 8:29 AM
    Tuesday, September 15, 2020 7:15 AM
  • Hi Cuen,

    The problem I have is there are in excess of 150 GPO's in our domain. Our country of which I am the administrator only have 25 GPO's. I don't particularly want or need to back up 150 and then delete 125 as this would be time consuming.

    Ideally I would like to select all my GPO's and have them backed up on a regular monthly basis.

    Regards.


    Peter Flint

    Tuesday, September 15, 2020 8:32 AM
  • $onesiwant = $gpos | where {$_.DisplayName -match "Thisismygpo-"}

    That's a filter. Filter by name (ie matching country code) and then the foreach loop will backup ones matching your filter. Not all of them.

    Q

    • Marked as answer by czql5v Tuesday, September 15, 2020 1:09 PM
    Tuesday, September 15, 2020 9:04 AM
  • Hi q94,

    thanks for the reply.

    so if my GPO's have a prefix of CKEX is this what I need to change  

    $onesiwant = $gpos | where {$_.DisplayName -match "CKEX-"}


    Peter Flint

    Tuesday, September 15, 2020 1:57 PM
  • Yeah that should work.

    If you run that, then just run the variable $onesiwant it will list all your policies that your where clause applied to.

    Hope this helps.


    Q

    Tuesday, September 15, 2020 2:13 PM