Archive for the 'Script Editor' Category

Reset PowerShell Runspace in PowerGUI Script Editor

Here’s another neat feature we have added in PowerGUI 3.0 – ability to reset PowerShell runspace when you need to.

All you have to do is:

  • Go to Debug menu, and click Reset Runspace.

And that will give you a nice new shiny PowerShell session with no variables or other changes left from your preceding work!

You can also make PowerGUI automatically reset runspace each time you start debugging if you:

  1. On the Tools menu, click Options,
  2. On Debug Options tab, select Reset PowerShell runspace each time debugging is started.

I somehow prefer manual method to automated one because quite often there is value in left-over variables (you get intellisense for example!), loaded modules, and so on. However, I can then manually reset the runspace before my final debug session to make sure the script works fine in a clean environment.

Either way, now you have both options at your command! Happy scripting!

(Screenshot taken from the original PowerGUI 3.0 announcement which lists a lot of other great features we shipped in that release)

Advertisement

Get add-ons right in Script Editor

One of my favorite features in PowerGUI 2.4 is the add-on finder in PowerGUI Script Editor.

As you probably know, Script Editor has tons of extremely useful add-ons with great additional features: from script signing to built-in help explorer. However, you used to have to install the add-ons manually – and this was a bit of a hassle. Now, all you need to do is:

1. Go to Tools / Find Add-Ons Online,

2. Enter keyword to do a search (or just click Search to see everything),

3. Select the add-on you want and click Install.

That is it! Hopefully this makes your scripting experience even more exciting. 🙂

Advanced PowerShell Options in PowerGUI Script Editor

This add-on from James Brundage (from www.start-automating.com) lets you easily fine-tune the PowerShell host right in the PowerGUI Script Editor.

1. Download the PowerShell Preferences add-on from here,

2. Unblock the zip file,

3. Extract it to the My Documents \WindowsPowerShell \Modules folder,

4. In Script Editor’s File / PowerShell Libraries dialog box, select PowerShellPreferences.

And you will get this panel in the script editor, allowing you to change all the internal settings of the PowerShell host:

  • Command history size,
  • Error history size,
  • Mail server for send-mailmessage,
  • Strict mode (automated checking for variable initialization, etc.),
  • What-if mode (automatically running all cmdlets with -whatif flag),
  • Error level,
  • Warning level,
  • Debug level,
  • Verbose message level,
  • Progress message handling.

Combined, these give you incredible control over the way that PowerShell works – which in turn can help a lot when debugging your PowerShell scripts.

Download the add-on here.

Happy scripting!

Dmitry

PowerShell Help Browser

This great PowerGUI Script Editor add-on by Gyorgy Nemesmagasi gives you the ability to browse PowerShell help topics right in the Script Editor (you can make the help window either float or be docked in the IDE) which makes it super-easy to lookup any PowerShell info when you need it:

The coolest part is that the add-on is loading all the information dynamically – so the cmdlet and alias list will depend on the actual set of snapins and modules you have, and the help information is in your language!

Very helpful and well worth checking out. Download the PowerShell Help Browser add-on here and make your PowerShell scripting experience even better! 🙂

Automate your PowerShell demos

Delivering a talk? James Brundage has just released an add-on giving you a rich demo environment right within PowerGUI Script Editor!

So next time you want to show PowerShell, all you need to do is:

1. Install James’ add-on onto your machine,

2. From Demo / Select Demo, chose the demo script you want to use,

3.  Click Start Demo.

4. Then optionally undock the demo control window and move it to presenter screen so your audience does not see it 😉 and click Next as you proceed:

The demo will go command by command, at any time you can intervene and just execute something in the PowerShell Console pane, show variables, and so on. And obviously when you are done – you can just switch to another script.

This is basically Jeffrey’s start-demo script + ability to see the demo library right in the PowerGUI Script Editor + the nice reach environment with intellisense and other goodies!

Next time you present PowerShell – use James’ demo tool. Download it right away and give it a try.

This add-on is participating in the PowerGUI Challenge 2010. Got a great add-on idea? Take part in the contest!

Set your syntax colors

Tweak color and font for any PowerShell element in PowerGUI Script Editor with this Script Color add-on which Denniver Reining from BitSpace.de has just posted:

Syntax highlightcolor picker for PowerShell in PowerGUI Script Editor

If you spend a lot of time scripting, you might have your own preferences  on the way your scripting environment displays keywords, cmdlet names, variable and so on. You used to be able to tweak these in PowerGUI Script Editor by manually locating and modifying one of our configuration files. Now there is an easy to use friendly graphical interface provided by Denniver’s add-on.

Download Script Color add-on and make PowerGUI Script Editor the PowerShell IDE of your dream!

Denniver’s add-on is participating in the PowerGUI Challenge 2010. Got a great add-on idea? Take part in the contest!

 

 

Formatted PowerShell everywhere

Getting PowerShell scripts with syntax highlight and line numbers into your blog, Word document or Outlook email is now easier than ever before! Once you download Karl Mitschke‘s Copy to Colorized HTML add-on, extract it to the modules folder and select it in the PowerShell Libraries dialog box, you’ll get Edit / Copy As / Colorized HTML (Ctrl-H) command  added to PowerGUI Script Editor menu.

Select the script, click the command, then paste the code into your email, document or other rich text control editor such as Live Writer.

Note, that this add-on is different from the native Copy As / HTML functionality which puts into clipboard plain text with HTML tags – this you would paste into HTML editing window of your blog, Karl’s add-on output – into a rich text editor. Nice complementary pieces of functionality. Now we got everything covered!

Karl’s add-on is participating in the PowerGUI Challenge 2010. Got a great add-on idea? Take part in the contest!

Improved script-signing in PowerGUI

Kirk has just updated his Script Editor add-on allowing you to sign your PowerShell scripts.

Script-signing is a highly-recomended best practice in PowerShell and the best way to prevent accidentally changed scripts or scripts downloaded from the internet and not properly tested and verified to be executed in your environment.

Kirk’s add-on is a great way to have code-signing integrated right into your script development environment absolutely for free. This is also one of our most popular add-ons which already had more than 700 downloads.

The new features include:

  • Replaced test certificate functionality with View Certificate, and updated result to show the certificate properties in the native windows dialog,
  • Updated script signing certificate search algorithm to search only in the “My” containers (the only places where script signing certificates will be stored),
  • Switched the default signing method to include all certificates in the chain.

Download the PowerShell Script-Signing add-on for PowerGUI here and let us know what you think.

Custom script header and other snippets

Check out the snippets for PowerGUI Script Editor that Bhargav Shukla just shared here. They offer nice templates which you can re-use when working on your scripts.

I downloaded and extracted the files to the snippets folder:

Started PowerGUI Script Editor, pressed Ctrl-I and could see the new snippets:

Here is what – for example – Custom_Script.Header gave me – very handy!

Check out these snippets here. And obviously if you have you own custom snippets that you created and are using – please consider sharing them with the community. 🙂

Top 7 Script Editor Add-Ons

Here is the run down of the most popular add-ons available for the PowerGUI Script Editor which can make your PowerShell scripting and debugging experience even more exciting:

1. PowerShell Script Signing – by far the number one add-on which already had more than 300 downloads.

  • Digitally sign any signable PowerShell file
  • Test the signature on any signed PowerShell file and view its details
  • Select a default script signing certificate from a list of valid code signing certificates
  • Automatically save files when you sign them
  • Configure which certificates to include in the signatures that are applied to files you sign
  • Optionally specify a timestamp server to be used when signing your files (recommended)

2. Believe it or not add-on changing the interactive PowerShell Console pane to familiar white on blue color scheme is number 2 in the charts with 165 downloads at this very moment.

  • Use a theme similar to the native Blue PowerShell Console right from inside the PowerGUI Script Editor

3. Clear PowerShell Console – 131 download so far:

  • Clear your embedded PowerShell Console by pressing Ctrl+R or selecting ViewClear PowerShell Console

4. Transcription Support has 108 downloads:

  • Full support for Start-Transcript and Stop-Transcript in the embedded PowerShell Console

5. Expand Alias – 86 downloads:

  • Expand aliases in the code pane to the full cmdlet name by pressing Ctrl+E or selecting Tools | ExpandAlias

6. Smart Execute Selection / Debug switcher – 68 downloads:

  • This Script Editor Add-on assigns the same shortcut key (F5) to run all code (Start Debugging) or selected code (Execute Selection). It also adds a new menu item ‘Run Code’ under the Tools menu.
  • Allows to run all code or selected code with one keyboard shortcut, F5.

7. Publish PowerShell Scripts Online – 53 downloads:

  • Allows you to publish any file you have open in the Script Editor on PoshCode.org
  • Preserves configuration for individual files so that you don’t have to re-enter the same information when publishing updates.

I love all of these and I highly recommend checking them out. Keep your eye on the PowerGUI Script Editor add-ons library – there is more great stuff coming.


My Recent Tweets

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

March 2023
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

%d bloggers like this: