Solved

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

Posted on 2014-12-18
4
467 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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
This article will help you understand what HashTables are and how to use them in PowerShell.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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 to another domain controller. Log onto the new domain controller with a user account t…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now