Solved

How to execute a Powershell script with a batch file

Posted on 2011-02-14
3
1,480 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
3 Comments
 
LVL 3

Expert Comment

by:andreibutu
ID: 34890475
0
 

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 70

Accepted Solution

by:
Chris Dent earned 500 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Join & Write a Comment

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

19 Experts available now in Live!

Get 1:1 Help Now