More PowerShell V3 Goodness

A few more things I wanted to touch on about PowerShell V3 before calling it a night:

A Better ISE

Finally, we have Intellisense in the ISE! This has been one of the most wanted things (for me at least) that was missing in the original ISE.

image

You can also see a new Command pane on the right hand side that lets you pick commands and run them. Another cool feature brought to use by the PowerShell team!

One last thing that has been brought up by other members of the community is the need to set the $psISE.Options.UseEnterToSelectInCommandPaneIntellisense to $True so it is easier to work with Intellisense in the command pane.

$psISE.Options.UseEnterToSelectInCommandPaneIntellisense = $True

Hopefully this gets changed to being the default by the time the production version of PowerShell V3 is out.

Code folding is also included free of charge, which really helps out when you’re working on a large script and need to lessen the view to just the area that you need to use. With code folding, you can minimize (hide) a section of code while you are working on a different section. Very nice feature to include!

image

 

Who needs {} anymore for Where-Object and ForEach?

As it says above, you no longer need to use the curly brackets when filtering with Where-Object or looping with ForEach. Another nice thing is you no longer need to use the $_. variable for filtering. Just use the property name.

Get-Process | Where Name -like 'ie*' | ForEach Stop-Process -Whatif

image

Better filtering for Get-ChildItem

Something else that is pretty cool is you can now filter for Directories, Files, various file/folder attributes (Read,System,Hidden,Archive) using Get-ChildItem which saves the time of using Where-Object to make this happen.

image

Available switches:

-Directory

-File

-Attribute (Can use other attributes like Archive)

-System

-Hidden

-ReadOnly

 

Fun with web pages

Remember my article about building a function to download web site information? Well, kiss that technique goodbye because the PowerShell team has brought in Invoke-WebRequest to make life a lot easier for you. Here is a quick example to pull an RSS feed from the Hey, ScriptingGuy! blog.

([xml](Invoke-WebRequest http://blogs.technet.com/b/heyscriptingguy/rss.aspx).content).rss.channel.item | 
Select Title, Link

image

So easy it is just craziness!

Extra stuff to check out from the download

After you download and install PowerShell V3, be sure to check out the stuff in the zip file. There is a treasure trove of information and free samples that you can check out and explore with.

Just one place to check out:

WMF3-CTP1-x64\Samples\WindowsPowerShell

image

I’m looking forward to checking out some of the workflow stuff in there as well and see what kind of stuff I can do with that. There just so many things that it would be impossible to list here. But you can keep with stuff via Twitter by using the #powershell and #poshv3 hash tags. Also, many more members of the PowerShell community are blogging it up with all of the new features as well.

About Boe Prox

Microsoft Cloud and Datacenter MVP working as a SQL DBA.
This entry was posted in News, powershell and tagged , , , . Bookmark the permalink.

One Response to More PowerShell V3 Goodness

  1. Jeff Patton says:

    Great article, I was pretty excited about the ISE as well and posted an article up on the Technet Wiki…lol

    http://social.technet.microsoft.com/wiki/contents/articles/4667.aspx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s