Windows PowerShell 3.0 is a hot cake in Windows Server 2012. It can automate anything and everything on Windows Server 2012, and it has 2400+ cmdlets with around 30 add-on modules. It supports auto loading of the required modules. It’s a real treat for IT guys.

Krishna Kumar

Krishna Kumar specializes in PowerShell, Exchange and Active Directory. Follow his blog SMTP Port 25.

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

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

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

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

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 3.0

where-object and foreach-object in PowerShell 2.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

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.

Join the 4sysops PowerShell group!

Your question was not answered? Ask in the forum!

0
Share
3 Comments
  1. Xenplex 7 years ago

    Will Powershell v.3 also be available for Win7?

    0

  2. techibee.com 7 years ago

    I have a question about the scheduled tasks. Is PS responsible for recurring schedules or it delegates that to Task Scheduler by creating tasks with defined schedule? I am asking this because, I might close my PS window after scheduling a job and wondering how PS will act in such cases.

    0

  3. Wimmer Christian 7 years ago

    Powershell 3 looks promising. Anyone happen to know if it will be available via Wsus someday?

    0

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2019

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account