Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to execute a Powershell script with a batch file

Posted on 2011-02-14
3
Medium Priority
?
1,519 Views
Last Modified: 2012-05-11
Experts,

             How would I execute a powershell file test.ps1 from a batch file so that no user interaction would be needed. (i.e. the user would not need to start up Powershell-if possible)?

Thanks, Missymadi
0
Comment
Question by:missymadi
[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
3 Comments
 

Author Comment

by:missymadi
ID: 34890756
What if the Powershell required a snapin "ActiveRolesManagement" ? And the script I have is a powershell script. How would I execute that from a batch file. Such as, an sql file is executed by a batch file.
0
 
LVL 71

Accepted Solution

by:
Chris Dent earned 2000 total points
ID: 34890772

Add it in the PS script :)

Add-PsSnapIn Quest.ActiveRoles.ADManagement

Then all you need in your batch file is this:

PowerShell yourscript.ps1

You can have more, you can prevent PS closing, or other things, but for the most part you need nothing more.

Chris
0

Featured Post

Q2 2017 - Latest Malware & Internet Attacks

WatchGuard’s Threat Lab is a group of dedicated threat researchers committed to helping you stay ahead of the bad guys by providing in-depth analysis of the top security threats to your network.  Check out our latest Quarterly Internet Security Report!

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…
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…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

618 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