Solved

How to execute a Powershell script with a batch file

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

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

688 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