Quantcast
Channel: Windows PowerShell - SAPIEN Blog
Viewing all 308 articles
Browse latest View live

PowerShell Studio 2014: What New in the Editor?

$
0
0

Let’s look at some of the new features you will find in PowerShell Studio 2014’s editor.

Improved Syntax Coloring

One of the first editing features you might have noticed in PowerShell Studio 2014 is the improved syntax coloring.

Parameter Attributes and Type Coloring:

PowerShell Studio will now color parameter attributes and types when valid:

Attribute and Type Coloring

External Tools Coloring:

Do you use tools like ping or ipconfig? Well we now color those tools as well:

External Tools

Unknown Command Coloring:

When the editor is unable to determine what a command is, it will color it as an unknown command. This gives you a visual hint that something maybe be incorrect in the script. For example, if you mistype Get-Process, the commands will display as follows:

Unknown Command

DSC Coloring:

We provide syntax coloring for DSC scripts:

Configuration

And yes, configurations will appear in the Function Explorer:

Configuration in Function Explorer

As time progresses, we will be adding more support for DSC.

 

Improved PrimalSense Support

We have also made numerous improvements to PowerShell Studio 2014’s PrimalSense.

Parameter Attribute PrimalSense:

Parameter Attribute PrimalSense

Parameter Alias for Functions:

PowerShell Studio will now display parameter alias for user defined functions:

Function Parameter Aliases

 

ValidateSet PrimalSense:
PowerShell Studio even provides ValidateSet PrimalSense for user defined functions:

Validate Set PrimalSense

 

New-Object Properties

You can use the New-Object cmdlet’s Properties parameter to specify the initial values for the object’s properties using a hash table. PowerShell Studio 2014 makes this easier by providing you with the list of the object type’s properties when working within a hash table:

NewObject Properties Hash PrimalSense


Dot Sourcing

We also provide PrimalSense support for dot sourced files, including parameter completion:

Dot Sourcing Parameters

 

PowerShell Studio now provides syntax coloring for functions in dot sourced files:

Dot Sourced Functions

Use the editor’s context menu to open the dot sourced file:

Go To Source File

 

Block Editing

Edit multiple lines at once by pressing  (Alt + Shift + Up /Down):

Multiline Editing

The editor also includes various other improvements, including PrimalSense support for PowerShell variables, such as $Error and $_ in the try catch block.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , ,


From script to server – Deploying solutions with PrimalScript 2014 (Part 3)

$
0
0

The last time we looked at the new installer option in PrimalScript 2014. You can find the article here: http://www.sapien.com/blog/2014/03/08/from-script-to-server-deploying-solutions-with-primalscript-2014-part-2

If you look at the deploy tab again, you will see a “Deployment” group. These functions will help you distribute your solutions to your target audience.

image5

 

First lets look at the settings. There are two items that are mandatory.

SNAGHTML4c28eb0

You need to have at least one file that gets deployed. If you look at the combobox, there are three items in it:

image

Depending on what else you have defined for your solution, the initial file to deploy can either be the associated script file, the packaged executable you created or the installer containing these items. The first time you bring this dialog up PrimalScript will select what seems most appropriate automatically based on your other settings.

Adding additional files is just as easy as it is for the installer part, simply drag and drop the file here from Windows Explorer. Make sure they will be accessible when you choose to deploy.

The destination of course is a required field. Without it PrimalScript won’t know where to copy things to. Pick a folder. Any folder.

For the additional deployment commands you can add any command line tools you like or need. If, for example you need to also ftp your MSI file somewhere, this would be the place to specify that command. These commands are executed in sequence, one at a time, so make sure you have no blocking tools in there which will potentially sit all night with a dialog up, waiting for your response.

Next time I will show you how to tie this all together and how to build your solutions for testing, unattended or scheduled. So stay tuned.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , , , ,

PowerShell Studio 2014: Comment Based Help

$
0
0

Previously, when creating comment based help in PowerShell Studio 2012, you either had to manually add the help comment or use the built-in comment based help snippet. The snippets worked well but you were still required to manually add each parameter of the function which takes time and there are better ways we would rather spend our time than writing help comments.

One of the new features we added into PowerShell Studio 2014 is the capability to automatically generate comment blocks for existing functions. You can generate comment base help for an existing function by:

1. Using the function explorer’s context menu:

image

2. Using the editor. Right click on the function’s declaration or the param keyword and bring up the context menu:

image

 

Generate Comment Base Help command will insert a help comment tailored to the specific function. The comment will include a .PARAMETER entry for each parameter declared in the function, include an .EXAMPLE entry and add any applicable output entry:

image

You will still need to supply the descriptive text (it can’t do everything for you) but the structure is there for you to update and edit.

If needed, you can expand on the help comment with the help of PowerShell Studio 2014’s PrimalSense:

image

 

At one point, you may add a new parameter to an existing function and need to update the help comment. By calling Generate Help Comment again, it will take any existing help comment and append any missing parameters to the comment block:

image

 

We hope that this new feature will help users save time and promote the use of help comments in their script.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , ,

WMI Explorer 2014 released!

$
0
0

The latest version of the WMI Explorer is available now on our website.

1_WMI Explorer 2014

Here are just a few highlights from the features in this release:

  • Superior performance using cached data and multi-threaded code gets you results fast
  • Explore and query local and remote machines.
  • A large variety of search options enables you to access the information you need faster and more precisely.
  • Filters allow you to reduce noise and focus only on relevant information.
  • Preset and custom queries let you not only examine the classes, properties and methods but also the underlying data.
  • View all documentation for any WMI object
  • Generates sample code for PowerShell and VBScript, including calls to WMI methods
  • Local cache allows you to browse remote machines even when not connected.

The release of WMI Explorer 2014 also marks the beginning of a new line of smaller tools. These tools will be sold separately or as a community package for a moderate fee. The proceeds from these tools will go towards supporting user groups and non-profit organizations.

WMI Explorer 2014 is now also part of the SAPIEN Software Suite and existing subscribers can download and use it immediately at no charge.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , , , , ,

PowerShell Studio 2014: Function Builder

$
0
0

PowerShell Studio 2014 introduces a quick and easy way to create complex functions using the new Function Builder:

image

Let’s cover each field of the Function Builder and how to create a function.

Cmdlet Name

The function builder provides you with a verb and noun field. The verb field contains a combo box with a list of approved verbs, but you have the option to enter your own unapproved verb if necessary.

image

Synopsis & Description

You have the option to enter a quick synopsis and a longer description using these fields. The information provided here will be used to generate the function’s comment-based help.

Cmdlet Binding

Check the “Enable Cmdlet Binding” option if you want your function to behave like a cmdlet and take advantage of PowerShell’s built-in parameters such as Debug and Verbose and/or process input from the pipeline.

This option will add the [CmdlingBinding] attribute to your function:

function Get-Noun {
    [CmdletBinding(SupportsShouldProcess = $true)]
    param ()
    if ($pscmdlet.ShouldProcess("Target", "Operation")) {
        
    }
}

You can set the cmdlet binding attributes by using the properties grid:

SNAGHTML14d56dc

Tip
The property grid provides a help description of each attribute.

 

Parameter Sets

The function builder allows you to specify multiple parameter sets, including a default.

image

Once you define a parameter set, you can assign it to each individual parameter.

Output Type

You can specify the output type of the function and the appropriate attribute will be added:

function Get-Noun {
    [CmdletBinding()]
    [OutputType([string])]
    param ()

}

The output type field also allows you to select from existing types:

image

The output type field also provides code completion for namespaces and types.

Parameters

The function builder makes adding a parameter as simple as typing in a name:

image

The grid of parameters, allows you to mark the parameter as mandatory, provide a name, parameter type and assign a property set. If needed, you can press the Details button or press (Ctrl + E) to open the parameter editor for more advanced settings.

 

Parameter Editor

Pressing the New Parameter button or the Details button will bring up the parameter editor:

image 

Use the parameter editor dialog to edit the details of a specific parameter such as adding validation and aliases.

Parameter Name:

Use this field to change the name of the parameter.

Description:

The description of the parameter that will appear in the help comment.

Alias:

(Optional) Provides an alternative name for the parameter.

Type:

Specify the object type of the parameter. Checking the “Switch Parameter” will make the parameter a switch parameter. This is the same as typing “switch” in the type field.

Settings:

In the settings you set the parameter’s attributes, such as marking the parameter as mandatory.

image

A helpful description is displayed in when editing a parameter attribute.

Validation:

The parameter editor also allows you to apply validation attributes to the parameter. Using the Add button you can select and add a validation type and in turn it will be added to the validation list:

image

Once added, you can modify the validation attribute using the property grid:

image

image

Parameter Set:

You can also set the parameter’s parameter set assignment with in the parameter editor:

image

 

Once you have added all the parameters and entered the information required, press the OK button in the Function Builder dialog. Now you have an advanced function ready to go:

image

The function builder is a time saver and a learning tool for those who may not be familiar with the intricacies of creating an advanced function.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , ,

Don’t always start from scratch

$
0
0

We use scripting to automate tasks that would otherwise be very repetitive. However, when it comes to creating a script most users start with a blank slate, an empty file. Then they hunt for copy and paste sources to start and the script fills with bits and pieces from other places. Next time a new script needs to be created, the same process starts all over again.

We have added a tiny little improvement to PrimalScript 2014 that might just make it easier for you to get started on a new script. You can save any file you have as a template with the content you want and need and the encoding your environment requires.

Let’s demonstrate.

image

We create a new PowerShell file from our default templates.

image

Maybe you don’t like our header, maybe you need some functions in there that you always use. Just modify as desired.

image

Now select “Save as template” from the backstage menu and give a fancy name. Make sure you use the correct extension, because that will determine the syntax coloring when you create a new file with that template.

image

In our example here we will name the file “My own PowerShell Template.ps1”

You can then close the file, or use it as a base for further templates you want to create. That’s up to you.

image

We used a list style control rather than big icons so you have more room for many templates and it also allows you to use longer, more descriptive names.

Questions? Comments? Suggestions? Head on over to our support forum and and let’s hear it.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , ,

PowerShell Studio 2014: Rename Refactoring

$
0
0

Another new feature of PowerShell Studio 2014 is rename refactoring. Rename refactoring allows you to intelligently rename variables, controls, parameters, functions and more.

You start by right-clicking on the object you wish to rename to bring up the context menu. Then select Rename… from the menu:

image

You are then presented with the rename dialog:

image

Let us cover each field:

New Name:

Here you enter the new name for the selected object.

Object Type:

This field lets you know what type of object you are renaming.

The field will display the following types:

Object Type Description
Event Updates the event variable and references in the designer.
Function Updates function declaration and function calls.
GUI Control Updates the GUI control variables and updates any event names and return variables for projects.
Parameter Updates the parameter for the function and any calls using the parameter.
Variable Updates variables within the document that aren’t a parameter or GUI control.

Note: Depending on the object’s type the some settings may vary.

 

Scope:

The scope lets you define in which scope the objects will be replaced.

Depending on the object type the following scopes may be selected:

Scope Description
Current Scope Rename refactoring only occurs within the scope of the current function or event block.
Current Document Rename refactoring will occur for all instances of the object within the current document.
Entire Project Rename refactoring will occur for all instances of the object within all the project files.

GUI Controls, Events, Parameters and Functions will always apply to the global scope such as the Current Document or the Entire Project.

Preview references changes:

When this option is checked, you will be presented with a dialog listing all the changes that will take affect.

image

Here you can preview the changes by clicking on any item in the list.

image

You can also uncheck an item if you do not want that particular instance to be modified.

Note: You are unable to uncheck items if you are renaming a GUI Control.

 

Rename Refactoring in Projects

Rename refactoring can be extremely useful when dealing with multiple files as in a project, because it will update all the project files (with the exception of excluded files):

image

In PowerShell Studio 2014 return variables are updated when a GUI control is renamed. In addition, when you rename a project file in PowerShell Studio 2014, all the reference functions and return variables are updated to reflect the new file name.

Tip
If you include ps1 files as content and dot source the file within a project, calls to functions defined in the dot sourced file can be updated using rename refactoring.

 

The new rename refactoring feature can be a big time saver when renaming events, variables, functions and other objects. In addition, with the preview you can quickly see where the object is used and selectively decide if you want to go forward with any change.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , ,

SAPIEN at Tech-Ed 2014, Houston, TX

$
0
0
20,000 feet

3-TechEd_2014

 

Its that time of year again… Tech-Ed Time! Of course, SAPIEN will be in attendance, will you? If you are attending Tech-Ed 2014, drop by our booth (#434) and say hello to Alex (our CTO), David (lead developer of PowerShell Studio) and June (Lead web technologies developer). They will be more that happy to give you the 411 on PowerShell Studio, PrimalScript and any of our other industry leading products.

On top of that, each day of the conference our team will be giving away a free copy of one of our products. Pick up a t-shirt on Monday, May 12 and wear it Tuesday, Wednesday or Thursday and you could be selected to win PowerShell Studio, PrimalScript or even the SAPIEN Software Suite, which has ALL of our products! But you MUST be there to win!

We are excited to be at Tech-Ed and hope to see you there as well!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , , , ,


SAPIEN Interviewed on the PowerScripting Podcast

$
0
0

Sapien_BlogFerdinand Rios (CEO) and David Corrales were recently interviewed on the PowerScripting Podcast with host Jonathan Walz and guest host Jason Helmick. Listen to the interview where they discussed the 2014 release and the new products added to the suite: http://powershell.org/wp/2014/05/28/episode-271-powerscripting-podcast-ferdinand-rios-and-david-corrales-from-sapien/   We would like give a big thank you to the PowerScripting Podcast for having us on as guests!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , ,

Back From TechEd: Fixing Name Resolution Issue with PowerShell

$
0
0

I really enjoy going to TechEd every year where I get to meet old friends and make new friends. It is also a great opportunity to speak with our users face to face. The one thing I do not enjoy about TechEd (and this seems to happen every year) is that upon return to the office, my computer no longer can discover other computers on any network, nor can I connect to a network share using the machine name. At some point during TechEd, I connect to a wireless network and it decides to change my network node type to Peer-To-Peer, which inevitably results in me pulling my hair trying to figure out why my UNC paths no longer work and returns an unknown error; yet I can still ping the machines by IP. So if you were wondering why each year it seems like my hair is thinning, you now know why (well part of the reason). To determine if the node type is altered from the default, type the following in your console: ipconfig /all ipconfig /all Make sure it the Node Type says ‘Hybrid’ and not ‘Peer-To-Peer’.   Since this issue has happened more than once, I decided to create a small PowerShell function to resolve this issue: Fix-NetworkNodeType (aka Fix-WhatTechEdBroke) Note: The function requires that you have admin rights in order to delete the necessary registry entries.

<#
    .SYNOPSIS
        Changes the network node to Hybrid.
    
    .DESCRIPTION
        Fixes a name resolution issue that is caused by connecting to a TechEd Wi-Fi network.
        The computer’s network node type is set to ‘Peer-To-Peer’ instead of the default ‘Hybrid’. 
        This function deletes two registry values to resolve the issue.
    
    .PARAMETER Reboot
        Specify if you want to reboot the machine.
    
    .NOTES
        The computer must be rebooted in order for the changes to take affect.
#>
function Fix-NetworkNodeType 
{
    param([switch]$Reboot)
    
    $Path = "HKLM:\System\CurrentControlSet\Services\NetBt\Parameters"
    Remove-ItemProperty -Path $Path -Name NodeType -Confirm  
    Remove-ItemProperty -Path $Path -Name DhcpNodeType -Confirm  
    if ($Reboot) 
    { 
      Restart-Computer 
    } 
}

As you can see the solution is very easy; you just have to delete two registry values and restart the PC. Please refer to this article for more details on the solution: http://support.microsoft.com/kb/903267/en-us

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , ,

PowerShell Studio 2014: Code Formatting

$
0
0

One of the new features we added to PowerShell Studio 2014 is code formatting. PowerShell Studio 2014 will now beautify your script while you type or when you paste content.

Often times when you paste a PowerShell script from the web, the lines aren’t indented correctly. With the PowerShell Studio’s code formatting, it will automatically indent your script.

image

Formatted After Paste:

image

 

Customizable Formatting:

PowerShell Studio 2014’s code formatting is customizable to fit your needs:

image

Formatting Triggers:

The first few options serve as triggers for auto formatting. These options tell PowerShell Studio when to format your script.

image

The following triggers can be enabled:

  1. When a user inserts a new line ie. presses Enter (Formats the line only).
  2. When a script block is completed by typing the closing curly bracket }  (Formats the code block).
  3. When a user types a semicolon ; (Formats the line only).
  4. When a user pastes text into the editor (Formats the pasted content).

In addition, there is an option to automatically indent the appropriate tab depth when inserting a new line.

Formatting Rules:

The second set of options allow you to customize the formatting rules of PowerShell Studio 2014.

Place open brace on new line:

Enabled

image
Disabled
image

Place statement keyword on newline:

Enabled (with open brace new line: disabled)
image

Disabled (with open brace new line: disabled)
image

Align parameter on line continue `:

Enabled

image

Disabled

image

Parameter Block Indent:
Indents the parameter declarations within a parameter block.

Indent: 1

SNAGHTML145d742

Indent: 0

image

Align parameter attributes:

Vertically aligns a parameter’s attributes declarations. When disabled it uses the Attribute Parameter indent value instead, to indent the subsequent lines of attributes.

Enabled
SNAGHTML1483f28

Disabled with Indent: 1
SNAGHTML149e97a

 

Let us know what you think. If you have any suggests or formatting options you would like to see added, please post a comment in our Wish List and Features Request forum.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , ,

PowerShell Studio 2014: Collection Project

$
0
0

In PowerShell Studio 2014, we introduced a new Collection Project. The Collection Project allows you to keep track of a group of files, which typically consists of (but not limited) to ps1 script files.

SNAGHTML2882e5

For example, you may have various ps1 scripts that dot source each other. Now you can create a Collection Project and enjoy the benefits being able to manage multiple files, PrimalSense support for dot source files and apply rename refactoring on all your files.

image

When you first create a Collection Project, you will notice there is no Startup.pss file. There is no entry point in the project since these are individual files. All files within the project are considered ‘Content’.

image

You can run each file individually using the Project’s context menu or using the usual Run Ribbon buttons  (v4.1.64 and up).

image 

Deployment is handled on a project basis, you can deploy all the project files to a single destination or create an install that includes all the project files.

 image

The project’s packaging is restricted because these are all individual files.

 

The new Collection Project allows you to group and deploy independent script files in an organized manner.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , ,

Using iPowerShell Pro’s PowerShell Web Access connection

$
0
0

In a previous blog I described how to connect to a PowerShell Web Access server with iPowerShell Pro. In this article, I will show you what you can do once connected.

First, connect to your PSWA server as described in this previous blog post. Once you are connected, that is where the fun begins.

Tap on the input line to bring up a keyboard.

IMG_0013

You can simply type in a PowerShell Command here and press SEND to execute the command on the server and see the results on the screen.

IMG_0012

If you TAP once on the screen, the toolbar with three options (BUILDER, HISTORY, SCRIPTS) will replace the input line.

IMG_0007

Tapping the BUILDER option brings up a popover list of all the cmdlets which iPowerShell Pro recognizes.

NOTE: the “i” at the right of the cmdlet name or the parameter name gives you a description of that item.

IMG_0008

Tap a cmdlet to select it and display its parameters.

Tap on as many parameters as you want to use and then tap the Done option.

IMG_0014

The command line will be filled with your cmdlet and its parameters and VALUE placeholders. If you tap on the PARAM button, each VALUE placeholder will highlight in sequence and you can type in the parameter value you want, then tap PARAM again to move to the next place holder. This process can be repeated over again when you pipe the output of one cmdlet to the input of another.

IMG_0015

Tap the screen again to bring up the toolbar and select HISTORY.

IMG_0009

A popover with the last 50 commands issued to this specific server is displayed. Selecting any one of these items will place it on the input line where you can just press SEND on the keyboard to send it along to the server. This history is saved in your iCloud account and will appear on any device running iPowershell Pro that is connected to that iCloud account.

The last option in the toolbar is the SCRIPTS command. If you have not connected iPowerShell Pro to your cloud service previously, the first time you tap this will take you to the appropriate service login. After that, a list of scripts on your service will be displayed.

IMG_0016

Tapping on the script name will place a call to that script on the input line. Execute it by tapping the SEND button.

Tapping the “i” at the far right of the script name in the list brings up a basic editor that you can use to make minor changes to the script.

IMG_0019

When you tap the back button, you will be prompted to save your file and then you will be returned to the script list where you can select a script to run. The saving process updates the script on the selected cloud service which in turn, will update the script on the server (assuming you have installed the cloud service on your server.)

 

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , , ,

PowerShell Studio: Initializing my GUI controls

$
0
0

If you are working with a GUI script within PowerShell Studio and find that you need to edit the exported script to modify the control’s initialization, then you are doing something wrong.

Don’t get me wrong, modifying and initialization of control properties is not the issue; in fact that it part of writing a GUI. What I’m referring to is the part where you are editing the exported scripts.

If you are editing the exported script:

1. You are creating an extra step which means you need to export and modify the script anytime you make a change to the original file.

2. It is time consuming and unproductive.

3. If you are working with Source Control or within a team environment, chances are the change will be missed or forgotten by somebody.

 

So if I’m not supposed to edit the exported script, then how do I initialize my controls?

Thankfully WinForms provides a convenient place to initialize your GUI controls, the Form control’s Load event.

The Form control’s Load event is called right before the form is displayed, which makes it a perfect place to initialize your controls.

$formServices_Load={
    #TODO: Initialize Form Controls here
    #Load the services into the the combobox
Load-ComboBox -ComboBox $comboboxServices -Items (Get-Service) -DisplayMember Name #Display the computer name in the form's title
$formServices.Text ="Services on $env:ComputerName" }

 

Warning: Do not try to initialize a control outside an event block within the script.

1. The control might not exist when this line is executed by PowerShell.

2. If the control does exist, your changes will most likely get overwritten by the designer generated script.

Alternatives to the Load event:

It is possible to use other events to trigger initialization. For example, some control sets such as the Chart – Disk Space use the VisibleChanged event to trigger initialization. This event is triggered when the control is displayed (such as when the form is loaded) or hidden using the Visible property.

$chartDiskSpace_VisibleChanged={
    if($this.Visible)
    {
        Load-DiskChart$this
    }
}

In the sample above, the control set initializes when the control becomes visible by checking its Visible property.

 

If your initialization script is running slow it can prevent the GUI from displaying in a timely manner or cause it to hang. In instances such as this, you might want to delay your initialization or simply run the query in a separate job then initialize and enable the controls after the job has completed the query.

Warning: You cannot access GUI controls directly from a Job. You must return the results first and then initialize the controls on the main thread / script.

For more details on how to use Jobs within a GUI script, please refer to the Creating Responsive Forms article.

For more details on Form control, please refer to the Spotlight on the Form Control article.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , ,

PowerShell Studio 2014: Verify Script

$
0
0

We offered a mechanism on how to import a remote machine’s Module profile as mentioned here and here. The import can be extremely useful when you need to work on a script that runs on a remote server.

PowerShell Studio 2014 introduces a new feature that lets you verify that your script will run on the remote machine by comparing the cmdlets and modules used in the script with those available on the remote machine. The Verify Script command will then produce a report listing all the missing modules and cmdlets on the selected machine.

Verifying your Scripts:

Start by selecting the appropriate machine from the Platform section in the Ribbon’s Home tab:

image

If you wish to select a remote machine, you will need to import the remote machine’s cache beforehand.

Next go to the Ribbon’s Tools Tab and press the Verify Script button:

image

PowerShell Studio will then evaluate the script and display the results in the Output panel:

image

Tip
PowerShell Studio’s editor offers a visual cue as to when a cmdlet is unknown:

image

As demonstrated, Verify Script offers a quick and simple way to verify that your script is capable of running on a remote machine.  Even though PowerShell Studio identifies unknown commands as you type, the Verify Script makes it easier for you to determine the necessary modules for the script to run.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , ,


PrimalScript 2014 PowerShell Debugger enhancements

$
0
0

PrimalScript 2104’s PowerShell Debugger has received a minor update with build 7.0.44.

The variables window now shows the actual .NET type of the underlying variable in a separate column.

image

In addition to that you can also see array data. If you look closely at the screenshot above you see a “[… Click to see array values …] for the variable called “myArray”.
Clicking on that will retrieve the first 20 items in this array.

image

It only retrieves a maximum of 20 items for performance reasons and because this particular way of displaying the array data does not lend itself to large data sets.

But don’t worry, we have already cooked up a better way to visualize large data items. One of the next service builds will roll out a further enhancement to this.

If you use hashtables in your code, as shown below, you will also be able to see the underlying data in the variables window.

image

 

image

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , , , ,

PowerShell Studio 2014: Improved Function Builder

$
0
0

In a previous article we covered the new Function Builder. In the latest service release of PowerShell Studio 2014 (v4.1.64), we improved parameter set support in the Function Builder.

SNAGHTML31bf1a

As you can see, we altered the ordering of the fields to improve the over-all work flow of the tool.

Notice the question marks? If you hover or click on a question mark, a help message will popup explaining the respective field.

image

Parameter Sets

The Parameter Set field has been expanded to include an Output Type. Now you can specify an optional output type for each parameter set you define.

image

When a parameter set is defined, the Function Builder reacts accordingly. For example, the Parameter Set Filter is enabled and a Parameter Set column is added to the Parameters list.

SNAGHTML356039 image
(Before a Parameter Set is defined) (After a Parameter Set is defined)

 

Parameters

The biggest change to the Function Builder is the parameters section. The columns have been reordered to create a better flow when defining parameters.

The Parameter Set column has been changed from a single selection combo box, to a text field where multiple parameter sets can be defined. You can simply type in the name of the parameter set you wish to assign to the parameter:

 image

You can also define a new parameter set within this field:

SNAGHTML38c909

Or assign multiple parameter sets to a single parameter by using a comma separator.

image

The Pos column is another new addition. This is an optional field where you can quickly define the parameter’s position attribute. By default, the parameter’s position is determined by the ordering of the parameters.

 image

For parameters that are assigned to multiple parameter sets, you can define each position by using a comma separator. The position values should follow the same ordering as the parameter set assignments.

Of course, you can also assign the parameter’s position and parameter sets using the parameter’s editor dialog by clicking the edit button:

image

We updated the Parameter Dialog’s Parameter Set section to allow you to assign multiple parameter sets:

image

Note that each parameter set has its own respective settings:

image

Parameter Set Filter

Another new addition to the Parameters section is the Parameter Set Filter.

image

The Parameter Set Filter allows you to either show all the parameters, only show the parameters that are not assigned to a parameter set, or only show parameters within a specific parameter set. Selecting a filter other than “Show All” allows you to work within that specific parameter set.

image

While in this mode, you can use the up and down menu buttons to move or swap the parameter positions.

For your convenience, the position field now only shows the parameter’s position with-in the selected parameter set and no longer lists the other parameter set positions when a filter is applied.

image

By default (Show All filter) the up and down move button only changes the order in which the parameters are declared in the function.

Note: In the Show All mode, the Mandatory check box refers to the parameter’s first assigned parameter set. 

 

When a parameter set is declared, the generated function will now include a switch statement to help you differentiate between the parameter sets:

    switch ($PsCmdlet.ParameterSetName)
    {
        'Name Set' {
            #TODO: Place script here
            break
        }
        'Data Set' {
            #TODO: Place script here
            break
        }
    }

 

We hope that these new additions and changes will increase your work-flow and make the creation of advanced functions with multiple parameter sets easier then ever.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , ,

PrimalPad 2014: User tools are back

$
0
0

With the 2012 release of the ever popular PrimalPad, our portable PowerShell and VBScript editor, we switched to the now almost ubiquitous ribbon user interface. One thing that disappeared because of that was the custom user tools menu. Mostly because, well, there was no menu to edit anymore.

SNAGHTML1984676f

The “User-defined Tools” ribbon group is pre-filled with the Windows Registry Editor, the Control Panel and the Computer Management plug-in, just to not have an empty group stare back at you. Click on the launch button in the group to edit the tools to your desire.

image

Launch button

SNAGHTML1988f617

Tool edit dialog

As you can see, it’s pretty straightforward. PrimalPad 2014 is available now as part of the SAPIEN Productivity Pack. The Productivity Pack is free for all licensed users of a current 2014 subscription.

As always, if you have any suggestions or need help with something, please head over to our support forum and let us know what you need.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , , , ,

SAPIEN Northern European tour begins

$
0
0
20,000 feet

Europe Tour

For the next two weeks, Ferdinand Rios, CEO of SAPIEN Technologies, will be touring northern Europe and speaking about Building PowerShell GUI Tool Solutions at various PowerShell User Groups. He will also be in attendance at  the PowerShell Summit. Below is a schedule of his appearances:

1) Oslo
Monday, Sept. 22nd, 2014
6:00 pm
University of Oslo
Gaustadalléen 23B
Oslo 0316 NO

2) Stockholm
Thursday, Sept. 25th, 2014
10:00 am
LabCenter,
Oxtorgsgränd 2
Stockholm, SE

3) Copenhagen
Monday, Sept. 29th, 2014
4:30pm
Microsoft Development Center
Frydenlunds Alle 6
2950 Trørød, DK

4) Amsterdam
Tuesday, Sept. 30th – Wednesday, Oct. 1st, 2014
All Day
PowerShell Summit
Park Hotel
Stadhouderskade 25
Amsterdam, NL

5) Amsterdam
Thursday, Oct. 2nd, 2014
1:30pm
Microsoft Netherlands HQ
Evert van de Beekstraat 354
1118CZ Schiphol, NL

If you are in the area for one of these user group meetings, come by and learn about Building PowerShell GUI Tool Solutions.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , , , , ,

PowerRegEx 2014

$
0
0

Those of you who previously tried the community preview of PowerRegEx 2014 will notice that we made some significant changes to the tool.

Here are some of the new features of PowerRegEx 2014

Ribbon Interface

The first major change is the new ribbon interface:

image

The ribbon interface makes it easier to access the application functions and features.

image 

The Clipboard section contains the usual copy and paste buttons, but in addition it includes the option to copy your regular expression formatted for PowerShell and other languages:

image

The Navigation section allows you to quickly go to a specific line in the document viewer or navigate between your regular expression matches.

The Export section allows you to export your regular expressions into a text document.

The Windows section allows you to show hidden panels and provides access to the Options dialog.

Updated Editor

The editor consists of a Regular Expression input line where you enter your expression and a document viewer where the expression is matched against.

image

The document viewer / editor allows you to test your regular expressions against any file. In addition, the view provides syntax coloring for a variety of file types including: PowerShell files, VB files, C# files, bat files, php files, xml files and many more.

You also have the option to customize the coloring of regular expression matches including the option to choose an alternate color for odd number matches. Using an alternate color scheme makes it easier to distinguish matches that are side by side.

image

New options include the ability restore the last open document and the last regular expression on start up. This way you can continue to work where you last left off when ever you open the application.

 

New Panels

In order to make it easier to work with regular expressions we added a few panels to PowerRegEx 2014. The panels help keep all the relevant information visible at all times without having to constantly dig into a menu.

 

RegEx Constructs Panel

The RegEx Constructs Panels lets you browser and select regular expression constructs:

image

You can expand or collapse each section by clicking on the arrow to the right of the group title:

image

To insert the desired construct into your current expression simply double-click the construct.

The RegEx Constructs Panel contains an Expressions section that includes predefined expressions:

image

When you double-click on a predefined expression, it replaces your current expression with the selected expression.

You can add your own expressions to the list by using the Save Expression button.

image

All expressions are saved in the snippet format, so that you have the option to import them into other editors if you desire.

 

Examples Panel

PowerRegEx 2014 automatically displays an example in the Examples Panel when you select a construct from the RegEx Constructs Panel.

image

The Examples Panel makes it easy for you to copy and paste the example expressions.

If you select a custom predefined expression in the RegEx Constructs Panel, the Example Panel will display the details of the snippet:

image

 

Output Panel

The Output Panel displays any error messages caused by incorrectly formatted regular expressions:

image

 

Status Bar

PowerRegEx 2014’s status bar is used to display the number of matches found within the open document. As of build v1.0.11, the status bar also displays the total time the RegEx expression query took to execute on the open file. The query time gives you a good indication of the performance of your regular expresses.

image

 

As you can see we made a lot of improvements to PowerRegEx 2014 since its community preview announcement. PowerRegEx 2014 is part of the SAPIEN Productivity Pack. The Productivity Pack is free for all licensed users of a current 2014 subscription.

Don’t have a subscription? You can still purchase the SAPIEN Productivity Pack by clicking here.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , , ,

Viewing all 308 articles
Browse latest View live