Powershell Import-GPO : The Data Is Invalid Fixed

Posted on April 20, 2010. Filed under: Powershell Tangents |

By: Brenton Blawat

This article is to aid those who are receiving the “Data is Invalid” error message in Powershell on Windows Server 2008 R2. This issue occurs while trying to import policies from one domain into their a different domain using a migration table. This issue has to do with the migration table editor referring to the “Pre-Windows 2000 Username” to migrate users instead of their Standard Username.

Syntax of Command Used for Error:

Import-GPO –BackupID {GUIDGOESHERE} –TargetName “Default_AccountingPolicy” –path “c:\scriptloc\” –MigrationTable “C:\scriptloc\DefaultMig.migtable” –CreateIfNeeded | Out-Null

Error:

“ Import-GPO : The Data is invalid. (Exception from HRESULT: 0x8007000D) “

Solution:

The issue has to do with creating Users and User Groups without the ‘SAMACCOUNTNAME’ field while coding with Powershell. Windows Server 2008 R2 generates a unique Pre-2000 username starting with ‘$’ and a series of numbers following. When using the ‘-migrationtable’ trigger, it causes import-gpo cmdlet to validate the “destination users” PRIOR to importing the group policy. If it cannot resolve the User or User group, it will cause the ‘’HRESULT error’.

The following lines were added to the Powershell Script for creating a User Group, which corrected this issue:

   1: # Where $objworker was the AD method and $ADobjname was the name of the user / group

   2: $objworker.put("sAMAccountName", "$ADobjname")

   3: $objworker.SetInfo()

 

Depending on your network, the fix can be done in two ways:

  1. Ensure the “Pre-Windows 2000 name” is the same as the “Standard Windows Name”
  2. Correct the Migration Table to Use the Pre-Windows 2000 Names for the ‘Destination’

Simple fix – just wish that the error would be more like “Errors in Migration Table”. The error message of “The Data Is Invalid “ is useless in my opinion.

Happy Coding!

Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

2 Responses to “Powershell Import-GPO : The Data Is Invalid Fixed”

RSS Feed for Business and Information Technology Tangents Comments RSS Feed

I came across the same error when using the Copy-GPO command. It turns out that my .migtable file did not have enough entries. My source GPO has lots of folder redirections and my .migtable file did not have an entry for the Downloads redirection. Once I added that entry everthing worked fine.

Thanks for the comment!


Where's The Comment Form?

    About

    Business and Information Technology Tangents is dedicated to providing quality content while informing the world about technology.

    RSS

    Subscribe Via RSS

    • Subscribe with Bloglines
    • Add your feed to Newsburst from CNET News.com
    • Subscribe in Google Reader
    • Add to My Yahoo!
    • Subscribe in NewsGator Online
    • The latest comments to all posts in RSS

    Meta

Liked it here?
Why not try sites on the blogroll...

Follow

Get every new post delivered to your Inbox.