Blog
Archive for the ‘Windows PowerShell’ Category
While investigating a bug report about ChangeVue’s installer we stumbled across a discrepancy with PowerShell’s PSModulePath environment variable. On a virgin Windows 7 machine the environment variable is set to “C:\windows\system32\WindowsPowerShell\v1.0\Modules\” via a System Environment Variable.There is no default that links to the per-user module path. If you query the environment variable in CMD you get the expected result: If you do the same thing in PowerShell you get a different result: Same thing happens in the ISE or any custom PowerShell host, like PrimalScript. Now, Microsoft says here to add persistent changes to the PSModulePath variable in the profile.…   More »
PowerShell Studio: Creating Responsive Forms
Wednesday, May 16th, 2012 by David Corrales
When working with GUIs you may have noticed that the Form can freeze when running long scripts. Previously I discussed how to make your loops more responsive in this article, but not every long script comes in the form of a loop. If you truly want to make your forms responsive, you will need to move these slow scripts into another thread and in the PowerShell world this means using jobs. For those of you who aren’t familiar with PowerShell Jobs, they allow you to run scripts while freeing up the console to perform other tasks. In this case it…   More »
PrimalScript 2012: What’s new? (Part 7)
Wednesday, May 9th, 2012 by Alex Riedel
Last time we told you about some new debugger features in PrimalScript 2012. And you already know all about the new Ribbon user interface this new version sports. One thing that we were really focused about in this version was to make navigating your code easier. Since there is no “PrimalSense” toolbar anymore the method combo box that enabled you to jump between functions needed to find a new home. If you load a file into PrimalScript 2012 you will notice the two new combo boxes on top of the edit window: The right-hand combo box serves as an indicator…   More »
Spotlight on the NotifyIcon Control
Tuesday, May 8th, 2012 by David Corrales
The “Spotlight on Controls” series focuses on a single WinForms control in PowerShell Studio 2012, details the important Properties, Methods, and Events of the control and demonstrates how to utilize the control. Most of the information about the controls is still applicable to previous versions of PrimalForms. Last time we took a look at the ListView control. This time we will look at the NotifyIcon control: NotifyIcon [System.Windows.Forms.NotifyIcon] Specifies a component that creates an icon in the notification area of the Window’s taskbar. Default Event: MouseDoubleClick Why use a NotifyIcon control? Use the NotifyIcon control, to alert users of special…   More »
PrimalScript 2012: What’s new? (Part 6)
Monday, May 7th, 2012 by Alex Riedel
VBScript users have told me on occasion that they are really jealous of one feature of PowerShell: Write-Debug Depending on the value of $DebugPreference this produces output when needed but makes it easy to silence diagnostic output once a script moves to production. VBScript and JScript developers have to sprinkle WScript.Echo calls through their code and then go and comment them out before handing the script off. In a large script with hundreds or even thousands of lines that can be a daunting and error prone task. You don't want to disable real output and not forget any diagnostic output.…   More »
PowerShell Studio 2012: What’s New? (Part 5)
Thursday, May 3rd, 2012 by David Corrales
Last time we looked at the new script editor features. Now we will take a look at the new Function Explorer as well as other additions. Function Explorer The new Function Explorer displays a list of all the functions and events within the current script file: If you are working within a Project, the available functions declared in other files will also be displayed. Navigating with the Function Explorer: Just by a simple double click on the function or event, it will take you directly to the declaration of the function. This becomes invaluable when dealing with scripts with a…   More »
PowerShell Studio 2012: What’s New? (Part 4)
Tuesday, May 1st, 2012 by David Corrales
Last time we looked at the new Control Sets. Now we will take a look at the new Script Editor features: Improved Syntax Coloring PowerShell Studio 2012 now colors cmdlet and functions parameters: Convert Cmdlet & Aliases Using the Context Menu or the Keyboard Shortcut you can convert your Cmdlets and Aliases. You can also convert from parameter aliases as well. Improved PrimalSense PowerShell Studio’s PrimalSense has also been greatly improved to increase your scripting productivity. Improved Parameter PrimalSense Support: Improvements include PrimalSense completion for Enumerators and Special Types: Enumerator Code Completion: PrimalSense for Special Types: PowerShell…   More »
How safe are credentials in script packages?
Monday, April 30th, 2012 by Alex Riedel
We get that question all the time. Before we start, please note that we do not advise to ever put credentials as plain text into any kind of code. Use encrypted strings, store encrypted credentials in files or, if all else fails, prompt. Now, having said that we all know that sometimes schedules and pressure from “above” forces you to do things you normally wouldn’t do. So for the sake of argument we have created a variety of executables which use SUPERADMINUSER and SUPERSTRONGPASSWORD to run a WMI query on SUPERSECRETSERVER. We used VBScript PowerShell C# C++ Obviously all of…   More »
PowerShell Studio 2012: What’s New? (Part 3)
Thursday, April 26th, 2012 by David Corrales
Last time we looked at the new Styles. Now we will take a look at the next major designer feature: Control Sets Control Sets are essentially custom controls that you can drag and drop from the Toolbox Panel into the designer like any other ordinary form control. They are made up of either single or multiple controls with predefined properties, events and functions. You can access the control sets in the Toolbox Panel under the “Control Sets” tab: PowerShell Studio 2012 comes with a number of predefined Control Sets that you can immediately use in your forms. Sample Control Sets:…   More »
PowerShell Studio 2012: What’s New? (Part 2)
Tuesday, April 24th, 2012 by David Corrales
Last time we looked at PowerShell Studio’s new UI features such as the updated Ribbon and custom layouts. Now we will take a look at the new Forms Designer features. Styles Have you ever got tired of applying the same properties over and over to controls such as anchoring? Well this is where Styles come into play, one of the new additions to PowerShell Studio’s Designer. So what is a Style? Styles are a set of predefined properties that you can quickly assign to one or more controls within the designer. Applying Styles: Let’s look at some sample Styles and…   More »
