Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2014-12-18
4
Medium Priority
?
616 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
2 Comments
 
LVL 24

Assisted Solution

by:VB ITS
VB ITS earned 1000 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 1000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

810 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