Solved

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

Posted on 2014-12-18
4
519 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MFA in Azure for a hybrid org 2 37
PowerShell and cisco ios 3 44
Script to Ping/Resovle names given IP 4 18
output in HTML format powershell 6 21
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
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 …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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