PowerShell Team
Automating the world one-liner at a time…
Latest posts
PowerShell Cheat Sheet – Now in XPS
I originally published Ben Pearce's PowerShell Cheat sheet in Word 2007 format. Given that I posted it a week before the Office 2007 launch, it turned out that not many people could read that so I posted it in PDF format as well. It now turns out that the corporate direction is to use XPS (I'm told that XPS viewers are readily available). Attached is an XPS version. I'm hoping that I can stop there and avoid publishing it in TROFF, TEX, SMGL, DECWriter, or any other formats. J Jeffrey Snover [MSFT]Windows PowerShell/MMC ArchitectVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShellVisit...
Virtual Machine Manager’s PowerShell Support
One of the cornerstone features of System Center Virtual Machine Manager (SCVMM) is PowerShell. They have built their entire GUI layered on top of PowerShell in the same way that Exchange 2007 did. A little while ago, I talked to Rakesh Malhotra (the Group Program Manager for SCVMM) about how things were going and he was very pleased with their bet on PowerShell. He talked about how their task-oriented Cmdlets provided a very user approachable scripting experience. I asked him for a few examples so he sent me a set of comparisons with VMWare's scripting experience (the VMWare script came from their website: ...
Windows PowerShell 1.0 for Windows Vista
As Jeffery promised to you folks, today we have offically released Windows PowerShell 1.0 for Microsoft Windows Vista. Thanks to everyone for patiently waiting for this release. To download Windows PowerShell 1.0 for Windows Vista, please visit the following links: For more details, please visit the following links: Enjoy Windows Vista and Windows PowerShell Hemant Mahawar [MSFT]Program ManagerWindows PowerShell
Working With WMI Events
PowerShell V1 does not provide native support for WMI events. That doesn't mean that you can't use WMI events with PowerShell, it just means that you need to leverage the .NET classes to do so. This falls into the category of "to ship is to choose". Here is a function that you can use to work with WMI events. This function takes a WMI class name (and optionally a path to a namespace [it defaults to root\cimv2]) and gets the events until you enter ESCAPE or 'q' at the keyboard. Function Get-WmiEvent ($class, $Path="root\cimv2"){$ESCkey = 27$Qkey = 81$query = New-Object System.Management.WQlEventQuery "Select * fr...
Executive Demo
I was in an executive review today where a team was demonstrating their technology (don't ask for details, I won't provide any :-) ). At some point they brought up this beautiful graphic showing the geographic distribution of resources and then the graph was changing based upon the state of the resources. We were all drooling like idiots when I happened to look at the title bar which said: "PowerGadgets"!!! You could have knocked me over with a feather. It really proved what I told the PowerGadgets team - people are going to love PowerGadgets because it makes them look awesome....
Controlling PowerShell Function (Re)Definition
A question came up in the PowerShell news group recently where someone was asking how they could prevent functions from being redefined. There are a couple of approaches you can use. First you can make functions read-only or constant. This is pretty straight-forward but does have some downsides. The other approach is to check to see if the function exists and only create it if it isn't already defined. First we'll look at defining read-only or constant functions. There isn't a way of doing this with the function keyword in V1.0 of PowerShell. Instead, you have to do this through the function namespace prov...
NetCmdlets Beta 2 is now Available.
nsoftware has released Beta 2 of NetCmdlet, a PowerShell snapin which provides Cmdlets for a wide range of protocols. The following is from their Release Notes: New In Beta 2 The current release is packed with new features, new functionality, and new Cmdlets for network management and Internet Communications. The following is an short list of some of the new and exciting features we added to this release: Networking Tools for IT Professionals The current package contains the following Cmdlets: I am particularly excited about the combination of PowerShell and NetCmdlets for produc...
PowerShell Cheat Sheet Redux – the PDF version
Attached is a PDF version of Ben Pearce's PowerShell Cheat Sheet. In the past I've encouraged everyone to speak up and complain if we were messing up or not giving you what you needed. I'm pleased to see that you have taken this to heart (seriously). Ben and every other Microsoft employee has been using Office 12 for quite some time now and saved the file using the new Office 12 format. Posting that format caused quite a bit of grief. Ron McMahon pointed out the error of our ways: You know, I realize that 2007 is now a whole 3 weeks old, but not everyone has jum...
PowerShell Cheat Sheet
Ben Pearce was gracious enough to put together a good looking PowerShell Cheat Sheet which I've included as an attachment to this blog post. By definition, a cheat sheet is incomplete so this contains the things that Ben has found to be the most import. I think you'll find it useful. Cheers! Jeffrey Snover [MSFT]Windows PowerShell/MMC ArchitectVisit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx Cheat Sheet V1.00.docx