troubleshooting Question

How to get a Powershell script to launch from Visual Studio

Avatar of David L. Hansen
David L. HansenFlag for United States of America asked on
.NET ProgrammingVisual Basic.NETPowershell
20 Comments1 Solution6446 ViewsLast Modified:
I have a PS script (myscript.ps1) that runs fine when launched from the PS command line. However, when I launch it from a Visual Studio app using the following code, the PS blue screen flashes quickly but nothing else happens (the expectation is the creation of a file). There doesn't appear to be any errors but I suspect one is listed in PS's blue screen.

Btw, launching PS scripts from VS is new to me, although I have set PS's rights and it's trusted folders already.

Process.Start("powershell", "-noexit -file 'c:\Temp\myScript.ps1'")
ASKER CERTIFIED SOLUTION
Chris Dent
PowerShell Developer
Join our community to see this answer!
Unlock 1 Answer and 20 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 20 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros