Click here to Skip to main content
12,999,010 members (48,397 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello Friends,
I'm trying to run a bunch of powershell script files one by one through a c# winform application using Process.Start(). Whenever I start a powershell for a scriptfile, it creates a new Powershell Process and runs a script file.

The problem with this is that, i'm not able to hold onto one single session so that I can use the variables initialized by the first script file in the second script file.

There are two ways to do it.

Method 1 :
Start multiple powershells using the same session

Method 2 :

Or pipe commands in to the powershell window so that I can have only one Powershell and run all script files in the same powershell thereby having only one session

Please let me know how to do Method1 or Method2

Thanks for your help in advance !
Posted 4-Aug-11 9:18am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 4 Aug 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100