PowerShell Team
Automating the world one-liner at a time…
Latest posts
V2 Interview: Universal Code Execution Model
At TechEd, I did an interview with Kevin Remde where I discussed the V2 Universal Code Execution model in detail. You can see it at: Universal Code Execution Model (UCEM)—a vision of how PowerShell scripts can run anywhere, anytime in just the right semantics. You can access the entire library of interviews HERE. Jeffrey Snover [MSFT]Windows Management Partner 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
Some WMI instances can have their first method call fail and get-member not work in PowerShell V1
Due to a problem retrieving the available methods in V1 that we have worked around for the upcoming version of PowerShell, you might experience that the first method call to a WMI object fails with a message that mentions: Exception calling GetType() with “0” argument(s): “You cannot call a method on a null-valued expression.” This happens when calling the first method in objects that are not in the root\cimv2 like: $instance=([wmiclass]"root\MyNamespace:MyObject").CreateInstance() &n...
When NOT To Use "WHERE"
I've seen a number of scripts that look like this: GET-XXXX | Where {$_.name -eq "foo"} or GET-XXXX | Where {$_.name -like "A*"} Whenever you see code like this, it is a sign that the GET-XXXX is not designed correctly. (NOTE: GET-XXXX is NOT a porn retrieval cmdlet - it is a standin for any GET-<SOMETHING> cmdlet). The whole point of a cmdlet is to think about the USER and deliver the correct experience. As a GENERAL rule, we encourage cmdlet developers to leverage PowerShell utilities like WHERE, SORT, FORMAT, etc and NOT to put that function into their cmdlets.&...
PowerShell Abstractions & the Community
Smart guy Don Jones has a good blog entry where he discusses ABSTRACTIONs with the question, "Do I need .NET, WMI, COM, and all that to use PowerShell?" ERGO: PS V2 enables the community to create and share the correct user abstractions so you don't have to wait for MSFT. NOTE: Even when MSFT provides full cmdlet coverage - you'll still need to know which cmdlets to use and how to stich them together to solve your specific problem. This is why I tell everyone that ALL ADMINS NEED TO BE ACTIVELY ENGAGED IN THE COMMUNITY. What's the best way to start with the community? &n...
All About Modules
One of the coolest new features of Windows PowerShell is PowerShell modules. I've just written a tutorial about how to use them on my personal blog. You can check out the full post for more details, but here are some easy things to remember about modules: The module examples also include a few PowerShell functions you might use in day-to-day life, such as being able to Search-WindowsDesktop, Get-RecordedTV, or Remove-RecordedTVBySeries, and are a great practical example of how you can use modules to cleanly separate code. Check it out. Hope this helps, James Brundag...
VMWare PowerShell Cmdlets Released (And Opportunity to Win $$$$)
On Monday VMWare offically released their PowerShell cmdlets in a ship vehicle called the VMWare Infrastructure (VI) Toolkit. What could be better than that? Yup - you guessed it - it's FREE!! Check out the details HERE. Download the free toolkit HERE. Free! What could be better than that? Well they could pay you to use it. :-) Well ... actually, it's almost that good. VMWare is holding a Scripting Contest for the best scripts using the VI toolkit. The winner will receive an all-expense paid trip to VMWorld 2008 Las Vegas or $5,000...
Invoking PowerShell from VBScript (COM)
There are a number of scenarios where you might want to call PowerShell from VBScript. You might already have an VBScript that does some function and you want to update it to include some PowerShell operation but don't want to convert the entire script to PowerShell. You might have some people on your staff that are very comfortable with VBScipt and aren't ready to put it down and do everything in PowerShell. You might have a management tool that is hardwired to invoke VBScripts and doesn't know anything about PowerShell (yet!). These are some of the scenarios we thought about...
Naming Shells and Consoles
Recently a product team asked me what entries they should put into their Program Groups folder. They need an entry to launch their admin GUI and to launch PowerShell with their snapin (they could do this by launching a Minishell which is a non-extensible version of PowerShell that has that products snapins baked in or they could do this by launching PowerShell specifying a console file (-PSConsoleFile ) which has their snapins). The question was - what should they call the PowerShell link. I thought a number of different options and then decided to look and see what the Exchange team had done.&n...
PowerShell Build Environment for Windows SDK
The Windows SDK team would like your feedback on what features you would like most in a future Windows SDK. One of your choices is a PowerShell Build Environment. If this is something that would be useful to you, go HERE and take the survey and let them know. Cheers! Jeffrey Snover [MSFT]Windows Management Partner 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