Earlier this year, I
said I would give some information regarding some of the many scripting tools
you can use for creating Powershell scripts.
Here are just a couple of those tools that I currently use or have used
in order to create my scripts:
1. PS Shell
This
is equivalent to the Command Prompt.
When the shell is started, you will see PS C:\
You can initialize
variables within the shell. Let's set
the variable $messsage to 'This is a test'
We can see what is
in the variable by running $message
The
variable and contents are keep in memory and can be used with further cmdlets.
The
drawback, for me, is that making changes involves either typing in a command
again, or using the arrow keys to bring back a command you ran. It may not be a problem if there are only a
couple of lines to the script. But, if
you want to create a script with a lot of code, you going to want to use an
integrated scripting tool.
2. Integrated Scripting
Environment (ISE)
The ISE is provided
by the Windows OS. You can start the ISE
by typing ISE in the Powershell shell
The ISE will appear
This environment
allows you to create and run a script in the right panel. When you run the script the output will
appear in the left panel.
Here are a couple of
tool bar items you should know how to use:
Click this if you want to run the entire
script. The keyboard equivolent is F5
This allows you to
run a specific line or group of lines in the script. For example
By clicking on the
You will only run
the $users line of the code. You can
then check what is in the $users variable by typing $users in the left panel.
This is equivolent
to CLS, it clears the output panel.
I like using the ISE
because a) it comes with Windows, and b) it allows you to create, update, and
run individual lines of a script.
I hope you find this
information helpful. Next week, I will
show you some popular free or pay tools that add some additional functionality
to the scripting environment.
No comments:
Post a Comment