PowerShell Team

Automating the world one-liner at a time…

Detecting Conflicts between Aliases, Functions, and Cmdlets

Version 1.1 of the PowerShell Community Extensions has just been release so I decided to kick the tires. After I installed it, I noticed that some conflicts and then realized that there might be conflicts between my customizations and the Aliases, Functions and Cmdlets that they delivered. Here is how I detected what needed to be resolved: ...

Scripting Pro VIP Interview

Scott Ottaway and I recently did an interview with Karen Bemowski. You can read it here. 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...

Why Can’t I Pipe Format-Table to Export-Csv (and get something useful)?

Ken's PowerShell blog has an entry Remote Services and PowerShell where he wrote a function to get services from a remote machine using WMI. He formatted the data using FT (format-table) and then went on to export the data to CSV. He pointed out that the following would NOT work rget-service remotemachinename netlogon | ft -autosize name,...

Invoke-Expression

I fixed a bug in Start-Demo (Script attached) that is worth exploring. The heart of Start-Demo is to get a line from file, display it and then run it showing the output. To do this I used Invoke-Expression (For simplicity sakes, I'm going to show you the code assuming that the line to execute is $LINE – the actual code is a bit more ...

How does the RemoteSigned execution policy work?

You might have wondered how the "RemoteSigned" execution policy protects us from running unsigned PowerShell scripts downloaded from the internet.  We use the URL Security Zones API related to "Attachment Execution Service" (AES) introduced in Windows XP SP2 and Windows Server 2003 SP1.  Internet Explorer and Outlook Express are ...

Managing SQL with PowerShell – PowerSMO

Dan Sullivan has been doing some great things using PowerShell to manage SQL. Dan wrote that Addison-Wesley book "A Developer's Guide to SQL Server 2005" along with Bob Beauchemin. He has now started a series of articles on this topic at simple-talk.com. Here are the first two but Dan told me that he'll be writing more so you might want to ...

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...

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 & 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 ...

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...