Latest posts by Krishna Kumar (see all)
- Review of Stellar Phoenix Mailbox Exchange Recovery - Wed, Jul 22 2015
- Configure Exchange 2013 Internet mail flow during migration - Fri, Dec 27 2013
- Exchange 2013 DAG recovery in a stretched AD site - Part 2 - Wed, Dec 25 2013
Let’s touch on some of the highlighting features of PowerShell 3.0.
New Integrated Scripting Environment (ISE) and Show-command ^
ISE is used to write and execute PowerShell scripts in a GUI. It has a bunch of new enhancements. I can say with confidence that you no longer have to pay for a third-party editor. Some of its interesting features are:
Intelligence – Display clickable and auto filling options. Below screenshot has the details
PowerShell 3.0 - Auto filling and clickable option
Add-on tools – WPF (Windows Presentation Foundation) control can be added using an add-on tool to provide an enhanced experience.
Restart manager and auto-save – One of the most wanted features is the auto-save option and auto opening of files if the ISE crashed.
Editor and help window enhancement – Help can now automatically launch Internet Explorer to connect to the Microsoft help site. A new editor feature is that it provides the much-needed expand and collapse option. Below screenshot below shows the expand and collapse option. I always felt that this was missing in the earlier version, and I think it is mandatory for any editor. The editor also has a nice look and feel and it comes with an integrated console.
PowerShell 3.0 - Expand and collapse option
Show-command is a new way of finding cmdlets through the GUI. It:
Helps in finding all the available cmdlets. Below screenshot show the searching of all cmdlets with the name computer in it.
PowerShell 3.0 - Find cmdlets
Provides the option to select the required module and view the cmdlets available in the selected module
Runs cmdlets from the GUI
Provides the option to copy composed cmdlets with attributes so you can save them for later use. Below screenshot has the details
Powershell 3.0 - Show-command parameter options
Simplified cmdlet syntax for where-object and foreach-object ^
PowerShell 3.0 makes it easier to use where-object and foreach-object. These objects are frequently used for checking conditions and looping. With PowerShell 3.0, you can stop using the dollar-underscore symbol ($_). At times, beginners and expert scripters alike can go wrong with the use of this symbol. The screenshots below show the difference between PowerShell 3.0 and PowerShell 2.0.
where-object and foreach-object in PowerShell 3.0
where-object and foreach-object in PowerShell 2.0
New operators –in and –notin ^
The new operators –in and –notin are pretty interesting. The screenshot below shows their usage. They work very similarly to the –contains and –notcontains operators.
PowerShell 3.0 - Use of –in and –notin operators
Auto loading of modules and their cmdlets ^
With a bunch of new modules integrated into PowerShell 3.0, it is difficult to remember these modules and import them before every use. To ease this, modules are automatically imported by default.
You can disable and enable auto loading of modules using the $PSModuleAutoLoadingPreference preference variable. I think it’s a good option. You can use it to keep your PowerShell scripts as light as possible and add only required modules whenever needed.
Scheduled jobs ^
This process takes a regular/standard script and schedules it. Scheduling can be a one-time task or a recurring one. I like this feature very much because it is such a pain to schedule a PowerShell script in earlier versions of PowerShell, where you have to write one more batch file to schedule the PowerShell script using the task scheduler. Now, this can be done with cmdlets. The schedule can be a single-line PowerShell command (script block) or a PowerShell script file. These schedule jobs can also be managed remotely with PowerShell remoting.
In my next post, I will discuss Workflow, Web Access, remoting, robust sessions, and delegated administration in PowerShell 3.0.