GPO backup fails

active-directorygroup-policy

When trying to backup a GPO using the GP management console (choosing the GP to backup, right click, hitting backup, and choosing a target directory "c:\ADB"), the backup fails.

In the Application eventvwr I can see the error is:

Backup of GPO failed. Error [The filename or extension is too long.]

But the detials are :

 Details -
     Source GPO:
          DisplayName: Default Domain Policy
          ID: 
          Domain: accad.int

      Backup:
         Directory: \\share\
         Instance : 
         Comment  : 

Which doesn't help me…

How can I get to the file that fails?

How can I turn on logging that can show me how to do it?

Is there any command line method to run this backup?


After running:

PS C:\Users\administrator> import-module grouppolicy
PS C:\Users\administrator> Backup-Gpo "Default Domain Policy" -Path c:\ADBackup -Comment "Backup-08-22-14"
Backup-GPO : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 c
haracters, and the directory name must be less than 248 characters.
At line:1 char:11
+ Backup-Gpo <<<<  "Default Domain Policy" -Path c:\ADBackup -Comment "Backup-08-22-14"
    + CategoryInfo          : NotSpecified: (:) [Backup-GPO], PathTooLongException
    + FullyQualifiedErrorId : System.IO.PathTooLongException,Microsoft.GroupPolicy.Commands.BackupGpoCommand

I still don't know where to start looking for the specific path / directory that is problematic…

THANKS!!


Since I couldn't find any small app that searches files with path longer than… – I wrote one.
You can find it at :
https://sourceforge.net/projects/pathlength/

It's a very small application that allows you to search the conditions that the AD (or generally apps) require.
The only thing to remember – run it on the DC that hosts the policies files (since in my case – the share name was shorter, but the c:…\SYSVOL was longer.

hope it will help.

Best Answer

You may have to troubleshoot a little further. Are you able to backup other GPOs? Did you try using an alternative admin account? Can you create a test one and back that up? If you can, then I would check permission on the previous GPO where you are receiving the error.

There is a powershell command you can use:

Backup-Gpo -Name MYGPO -Path C:\GpoBackup -Comment "Backup-08-21-14"