Tuesday, December 23, 2008

v2 CTP3: Running PowerShell silently

Well, if you haven't heard, v2 CTP3 is out. Check it HERE.

This new release provides a feature where powershell.exe can be run with a hidden window/screen. This is definitely an FAQ candidate: I've seen this asked many times in various forums.

PS>powershell.exe /?
Sets the window style to Normal, Minimized, Maximized or Hidden.

(The CTP3 release notes have a typo: This parameter is covered as "-WindowsStyle".)

So if you run something simple like:
PS>powershell.exe -windowstyle hidden # from PowerShell

Be prepared... Not only will your current PowerShell console vanish, but you'll also have another PowerShell host running.

What do I mean, if you try the above, then open another PowerShell console, you could see:
PS> gps powershell

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
331 6 21396 7640 127 0.94 904 powershell
168 6 24384 33332 127 0.61 4752 powershell
210 6 25816 33936 129 0.53 5324 powershell

So, running with "hidden" hides the current process you just invoked, but also hides the console from which it was called/invoked in the first place.

This new hidden features is definitely useful for stuff like scheduled tasks where the solution before was to either wrap the PowerShell in VBScript or even use the Win32 APIs to do something more complicated.

Wednesday, December 17, 2008

Windows PowerShell Virtual User Group #8--IN THE WORKS

Plans are underway for meeting #8. Looks like it will be January 29th at noon EST (New York time).

Tentative speakers/topics:
Jeffrey Snover (Microsoft): PowerShell v2 news.
June Blender (Microsoft): New PowerShell help features.

I may do a small presentation also... Not sure yet. If there's anything you'd like to see demo'd, leave a comment!

I may invite Compellent (www.compellent.com/powershell) to do a live demo of their new PowerShell cmdlets.

Windows PowerShell Virtual User Group #7--VIDEOS

So, I'm going with a different format this time. I'm going to post the raw videos, and simply post the timing for each section. This keeps the file sizes 10x smaller! It also saves me extra work.

Here's the "time layout" (format is MM:SS or HH:MM:SS):
-Intro (Marco) 8:55-16:00
-Nathan 16:00-44:55
-Joel 45:25-1:12:55
-Idera 1:13:10-1:33:55
-Closing (Marco) 1:35:00-1:38:45

For the details on each speaker's topic, see HERE.

WMV format: For use with most players

HFP format: This can be viewed through a web browser (the file needs to be unzipped)

Your feedback is welcome!

Tuesday, December 16, 2008

PowerShell Podcast - this Thursday evening

Jonathan and Hal continue to put on an excellent live PowerShell podcast every Thursday HERE.

This Thursday two members of the Microsoft PowerShell team will be on the podcast: Jeffrey Snover and Bruce Payette.

Jeffrey Snover keeps us informed on http://blogs.msdn.com/powershell and Bruce Payette is the author of PowerShell In Action.

I'm planning to listen in live for this one... It would be my first...

Windows PowerShell Virtual User Group #7--UPDATE

I blogged it HERE: I don't have the #7 recordings ready for download yet. I'm sorry...

I promise to have something in the next 24 hours.

Sunday, December 14, 2008

OpsMgr Shell: Another advanced example of PowerShell and the SDK

Here's another post on advanced usage of the OpsMgr SDK and PowerShell. As I get into more complicated things, it seems I keep running into .NET Generics and collections more and more.

I had quite the time when I came across a read-only collection, and needed to edit it. Fortunately, Jaykul, Oisin and Bruce Payette all came to my rescue.

The result is HERE, where I show:
1. How I am handed a read-only collection by the OpsMgr SDK.
2. I recreate a new generic list with just the elements I want from that read-only collection.
3. Then recreate that read-only collection using my new list.


Saturday, December 13, 2008

Windows PowerShell Unleased 2nd Edition--AVAILABLE

I first blogged about the book HERE. Well, it is now "In Stock" on Amazon.com HERE.

Please feel free to leave comments on my blog or on Amazon. I welcome any/all feedback, and will use that feedback for a probably 3rd edition.

I enjoyed working with Tyson and Pete, and can appreciate now how much hard work it is to put your thoughts onto paper in a clear and concise way.

I hope that anyone that reads the book will find it a valuable reference.

Saturday, December 6, 2008

OpsMgr Shell: Advanced example using PowerShell and the SDK

I've got a new post up HERE on the System Center Forum site.

The title is "Advanced example using PowerShell and the OpsMgr SDK: Creating and Updating Groups". I basically translate a post from Jakub Olesky HERE.

I'm going to do a few more related blog posts where I split the above code into two functions/scripts.