Solved

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

Posted on 2014-12-18
4
546 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

707 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