PowerShell Team
Automating the world one-liner at a time…
Latest posts
Renaming Files
Let's have a little fun with Rename-Item: [3112:0]PS> dir Directory: Microsoft.PowerShell.Core\FileSystem::C:\temp\jpsMode LastWriteTime Length Name---- ------------- ------ -----a--- 3/5/2007 4:21 PM 948 a-a--- 3/5/2007 4:21 PM 1214 b-a--- 3/5/2007 4:21 PM 1480 c[3112:0]PS> dir |Rename-Item -NewName {$_.Name + "1"}[3112:0]PS> dir Directory: Microsoft.PowerShell.Core\FileSystem::C:\temp\jpsMode LastWriteTime Length Name---- ------------- ------ -----a--- 3/5/2007...
Improved Start-Demo Script
I showed my Start-Demo script to my wife and she wasn't impressed J. She gave me some good ideas about how to make it better so I've updated the script and attached it to this entry. The changes are: 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 start-demo.ps1
Windows PowerShell & Microsoft Management Console (MMC) ISV Workshop
Dear Valued Microsoft Customer, You are invited to attend the Windows PowerShell & Microsoft Management Console (MMC) ISV Workshop (Building Next Generation Command Line and GUI Applications on Windows) on April 18th & 19th 2007. This is a free two-day event, located on the Microsoft Campus, Redmond, WA. This in-depth briefing on Microsoft's Windows PowerShell and MMC technologies and workshop training is designed for Independent Software Vendor and Enterprise Developers and Architects who are developing or are planning on developing applications based on the .NET framework. Exchange Server 2007 and ...
Note on Performance
Vinicius Canto posted a comment regarding the performance of the QL function that I posted in my Year of the Pig Revisited – the magic of QL blog post. He found that this function was 16x slower than creating an array using the form: @("Pig", "Rat", "Ox"). That is good to know and if you have a script which you need to speed up, this is one area you might want to look at. That said, we did little to no work on performance in V1 so it would be a mistake to hardwire your coding practices according to the performance characteristics of this version. We are going to do work on performance for the next release so t...
Software Inventory
Otto Helweg has started a blog called Management Matters that I think you'll enjoy. He just posted an entry about how to use PSINFO (from SysInternals) and PowerShell to do a quick and dirty software inventory and displaying the results to a screen or storing them in a database. Give it a read – it's cool stuff. 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
Internet Radio Function
I found a cool blog entry at http://hung-yuwu.spaces.live.com/Blog/cns!744FB258BF8C8020!1377.entry . I have no idea what it says but I can read the script and I like it. The person has an internet radio site that they like and wrote a simple script to get run it in an IE windows with a fixed size and location and without all the IE adornments. I love this stuff! function ufo-radio{ $ie = new-object -com "InternetExplorer.Application"$ie.Navigate2("http://radio.hinet.net/radio/player/player_ie.jsp?radio_id=232");$ie.width = 400$ie.height = 270$ie.Top=500$ie.Left=0$ie.Resizable =$false$ie.ToolBar =$false$ie.MenuBa...
Functions vs Filters
In my previous entry, I referred to Rsbohn's blog PowerShell $Profile and his function to slow down output function slowly ($tempo=100) { process { $_; Start-Sleep -milliseconds $tempo}} This is a good candidate for a FILTER. A filter is function that just has a process scriptblock. So you could have written his as: filter slowly ($tempo=100) { $_; Start-Sleep -milliseconds $tempo} Enjoy! 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/scriptcente...
Start-Demo: Help doing demos using PowerShell
A couple a weeks ago I got a call from BillG's Technical Assistant (TA) telling me that Bill and Ray (Ozzie) wanted to get a demo of the new stuff we were doing with PowerShell. The setting was Bill's conference room that would be organized with a number of Demo stations. You'd get called in and were allowed to bring one other person but then it would be Bill and Ray sitting next to you getting the demo – so you pretty much have their full attention. That's great except for the fact that I am a bad typist and make mistakes all the time. That is why PowerShell supports wildcards, parameter disambiguation and tab c...
Improved PowerShell grammar Documentation
Bruce Payette is a co-designer of the PowerShell language and the development lead for its implementation. From that, you might guess that his book: Windows PowerShell in Action would provide a great explanation of the language and how to use it – you'd be right. In the past, we've posted a PowerShell grammar document but a number of you have provided feedback that it wasn't as helpful as it could be. Bruce has worked with his publisher, Manning Press, to rectify that situation by posting Appendix C: The PowerShell grammar on the website (see the link above). This chapter provides the PowerShell grammar annot...