Here are some instructions on creating and writing your Hello World for PowerShell
- Create a text file and name it "Hello.ps1"
- Open up this file in a text editor of your choosing.
- Write inside of this text file: "write-host "Hello World.""
- Open up PowerShell
- Make sure your default location is set to the same folder of the location of the file. You can also drag and drop the file to your PowerShell window and press enter.
- Once the command runs, you will see it write Hello World.
If you are running PowerShell for the first time, you may see this:
If it returns "Restricted", then this means you need to change the Execution Policy.
Once again check to see what the policy is by typing: "GET-ExecutionPolicy". Verify it does not say "Restricted".
In order to return the settings back to the original settings, simply type: "SET-ExecutionPolicy restricted"
Congratulations, you just wrote your first PowerShell script!
No comments:
Post a Comment