Logo 
Search:

PowerShell Article

Submit Article
Comments on Hello World Program in PowerShell
Category: PowerShell (General)    Author: Vivek Patel

First Program in Windows PowerShell. Hello World Program will display simple "Hello World" on screen.


Umesh Chape
Umesh Chape from IndiaMay 09
HI ,

I running below code to execute power shell from asp.net application.

System.Management.Automation.Runspaces.Runspace runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace();
runspace.Open();
System.Management.Automation.Runspaces.Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript(@"\\servername\path");

pipeline.Commands.Add("Out-String");

Collection<PSObject> results = pipeline.Invoke();

runspace.Close();


But I am facing the error ".ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details."

The same code is running from command prompt and windows (winform) application .

Thanks .


Please enter your Comment
  • Comment should be atleast 15 Characters.
  • Please put code inside [Code] your code [/Code].