Solved

I am getting the following error when running GPO import script, please help

Posted on 2014-12-18
4
496 Views
Last Modified: 2015-01-07
I am getting the following error when running GPO import script, please help
Script error:

PS C:\scripts> .\Import_GPOs.ps1 -Domain test.labcom -BackupFolder "C:\GPOBackup\12.15.2014" -MigTable -SomInfo -W
MiFilter
Cannot process the "#requires" statement at line 94 because it is not in the correct format.
The "#requires" statement must be in one of the following formats:
"#requires -shellid <shellID>"
"#requires -version <major.minor>"
"#requires -pssnapin <psSnapInName> [-version <major.minor>]"
At line:1 char:18
+ .\Import_GPOs.ps1 <<<<  -Domain lab.test.com -BackupFolder "C:\GPOBackup\12.15.2014" -MigTable -SomInfo -WMiFilt
er
    + CategoryInfo          : ObjectNotFound: (:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
0
Comment
Question by:creative555
4 Comments
 
LVL 24

Assisted Solution

by:VB ITS
VB ITS earned 250 total points
ID: 40508120
You need to import the Active Directory and Group Policy modules in PowerShell first.

Before you run the .PS1 script, type in Import-Module ActiveDirectory and then Import-Module GroupPolicy then run the script. It should look something like this:

Import-Module ActiveDirectory
Import-Module GroupPolicy
.\Import_GPOs.ps1 -Domain test.labcom -BackupFolder "C:\GPOBackup\12.15.2014" -MigTable -SomInfo -WMiFilter

Open in new window

0
 
LVL 10

Accepted Solution

by:
Michael Ian Claridge earned 250 total points
ID: 40515758
Hello,

It reads as though nothing in the #Requires statements have been defined, if you don't need this you can remove the statements and import the AD and GPO modules on the same line.

http://technet.microsoft.com/en-us/library/hh847765.aspx

Import-Module ActiveDirectory,GroupPolicy

Open in new window


I hope this helps

Regards

Michael Ian Claridge
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question