Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# PowerShell
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 10:18am

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

  Print Answers RSS
0 Marcin Kozub 310
1 OriginalGriff 248
2 Sergey Alexandrovich Kryukov 215
3 Richard MacCutchan 202
4 Praneet Nadkar 197
0 OriginalGriff 8,048
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 4 Aug 2011
Copyright © CodeProject, 1999-2014
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