PowerShell Team

Automating the world one-liner at a time…

Latest posts

Feb 23, 2007
Post comments count 0
Post likes count 0

Why isn’t “New-Object” aliased to “New”

PowerShell Team

Alistair Young made a Note to Self : In a standard PowerShell installation, "new" is not an alias for "new-object". You added that. You should therefore know better that to make this kind of dumbass mistake. We talked about making "New" an alias to "New-Object" but decided against it in the end because it leaves open the door for us to provide a C#-like NEW keyword sometime in the future. We want PowerShell to provide a nice glide path to C# so in the future, we'd like the following to be equivalent: $x = New-Object System.DateTime 2007,12,25 $x = new System.DateTime(2007,12,25) So if we decide to implement this...

Feb 23, 2007
Post comments count 0
Post likes count 0

Admin Development Model in Action

PowerShell Team

Ken Taylor has a PowerShell blog over on LiveSpaces. Today he posted a blog entry, Enabling RDP with PowerShell, that had me jumping for joy as a perfect example of the Admin Development Model in action. The whole point of the admin development model is that you use tools to quickly investigate the system and manage it. Ken needed to enable RDP on a remote Server and remembered that it was possible to do via WMI. Read his blog for the steps he used to quickly and easily investigate the system to find exactly want he needed to do within 2 minutes!. The only thing Ken didn't do was to encode this information i...

Feb 23, 2007
Post comments count 0
Post likes count 0

Leveraging PowerShell Semantics to do More with Less

PowerShell Team

Brad Wilson – the .NET Guy recently posted a set of scripts showing how to drive TortoiseSVN from PowerShell. I thought I would use one of these to highlight how you can leverage the PowerShell semantics to do more with less code. PowerShell is provides Shell semantics and sometimes allows you to ask for more formal, programming, semantics. Specifically, if you ask for a variable that does not exist – PowerShell does not consider that an error. In the same token, if you ask for a PROPERTY of a variable and that property does not exist, that is not an error either. PowerShell doesn't complain – we give you a n...

Feb 19, 2007
Post comments count 0
Post likes count 0

“Windows PowerShell in Action” has been released…

PowerShell Team

Since a lot of people have been asking about it, yes - my book "Windows PowerShell in Action" is finally in stock and available on-line from http://amazon.com , http://www.barnesandnoble.com/ as well as directly from the publisher http://manning.com/powershell . It should be available in the store at Barnes and Noble and Borders later this week. Thanks for everyone's patience.   There are a couple of short reviews on Amazon, a quite entertaining one on the Barnes and Noble site: http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?z=y&EAN=9781932394900&itm=1 and a slightly longer one at: htt...

Feb 15, 2007
Post comments count 0
Post likes count 0

Execution Policy and Vista

PowerShell Team

Some of you may be getting an error when trying to set the execution policy on a new install of Windows PowerShell in Vista:  PS C:\Users\leonard> Set-ExecutionPolicy unrestrictedSet-ExecutionPolicy : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is denied.At line:1 char:20+ Set-ExecutionPolicy  <<<< unrestricted This behavior is by design. As a system-wide default that affects all users, the ExecutionPolicy is stored in the HKLM registry hive. PowerShell users on XP and Windows Server 2003 likely didn't see this as most use...

Feb 14, 2007
Post comments count 0
Post likes count 0

It’s All about Economics

PowerShell Team

There is a cool blog over on Windows Live Spaces called PowerShell for Testers. This has a bunch of great technical meat around script testing and testing using scripts. The most recent entry is on Lowering the Cost of Test Automation which makes the case the PowerShell excels at lowering the cost of test automation. I'm very pleased to see this because I strongly believe that at the end of the day, it's all about economics. My argument is that there are lots of great technologies but that technologies that matter and endure are those technologies which yield an economic advantage. I like to boast that every ...

Feb 8, 2007
Post comments count 0
Post likes count 0

Port 25 interview with Bruce Payette

PowerShell Team

Port 25 recently interviewed Bruce Payette. Bruce is one of the founding members of the team, is the development lead responsible for the PowerShell language, and is the author if the soon to be released PowerShell in Action from Manning Press. I think you'll find this interview very worthwhile. Check it out at: http://port25.technet.com/archive/2007/02/08/powershell-in-action-hank-interviews-bruce-payette.aspx  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....

Feb 5, 2007
Post comments count 0
Post likes count 0

PowerShell Tip: How to “shift” arrays…

PowerShell Team

It's fairly common in scripts to extract the first element out of an array then "shift" the remaining elements. Perl has a special shift operator for doing this as do many of the UNIX shells. PowerShell, however, doesn't have a shift operator built-in. So how do we shift arrays in PowerShell? Well – we could do it the brute force way and simply copy all of the elements after the first one but that sounds like too much work. A way to make it a bit easier is to use the range operator ('..') and array slices as shown: $first = $oldArray[0] $oldArray = $oldArray[1 .. ($oldArray.count-1)] But that's...

Feb 2, 2007
Post comments count 0
Post likes count 0

Processing text, files and XML

PowerShell Team

Manning Press was generous enough to put another chapter of Bruce Payette's Book PowerShell in Action book online. Presumably you'll read it and become convinced that you must buy the book in its entirety. Whatever the motivation – we all get a great free chapter on Processing text, files and XML. I was honored to be offered the opportunity of writing the forward. You can read that online as well. 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/techne...