Home > Articles > Operating Systems, Server > Microsoft Servers

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Testing the PowerShell Editor

The PowerShellPlus has, according to the WPS console, two modes: an interactive mode and a script mode (see Figure 1.14). After starting the PowerShellPlus, you will see the interactive mode. You can use any commandlet (or pipeline). When you press Return, the commandlet is executed, and the result displays in the same window. The handy feature is the IntelliSense. If you enter Get-P, you will see a drop-down list of the available commandlets that start with these letters.

Figure 1.14

Figure 1.14 WPS IDE in interactive mode

To use the PowerShellPlus in script mode, click Code Editor and create a new script file (New/PowerShell Script) or open an existing script PS1 file (Open). Now open the script file CreateUser.ps1 that you created earlier. You will see line numbers, and you will encounter the same IntelliSense features that you have in interactive mode. To run the script, click the Run symbol in the toolbar (see Figure 1.15). The result will display in the interactive Windows in the background.

Figure 1.15

Figure 1.15 WPS IDE in script mode

Another great feature is debugging. Place the cursor on any line in your script and click the Debugging icon. Next, go to any line and press F9. This creates a red circle next to that line, called a breakpoint. Now run the script. You will see the PowerShellPlus Editor executing the script in slow motion, marking the current line yellow and stopping at the line with the breakpoint (see Figure 1.16). In the Variables Inspector window, you can inspect the current value of all variables. In the interactive window, you can type any WPS command that will be executed within the current context. That is, you can interactively access all script variables. To continue the script, press F8 or click the Continue icon in the toolbar.

Figure 1.16

Figure 1.16 Script debugging with the WPS IDE

Code snippets are also a nice feature of the PowerShellPlus. In a script file, click Snippet/Insert on the toolbar or select Insert Snippet in the context menu in the main Editor window. You will be able to select a snippet. You can create you own snippets with the PowerShellPlus (via Snippets/New on the toolbar).

  • + Share This
  • 🔖 Save To Your Account