|
|
|
|
|
June 09 2009
In CTP2 of PowerShell v2, we added a new parameter to Get-Help: Online. This parameter lets help authors declare an “online version” of their help topic, which PowerShell then launches with your default browser. For the PowerShell cmdlet help topics, we redirect to the excellent (and more frequently updated) online cmdlet help topics: http://technet.microsoft.com/en-us/library/dd347701.aspx.… read moreThings more likely to kill you than Swine Flu
April 29 2009
There are a few. Based on worldwide numbers (160 confirmed deaths, 3000 “suspected” cases) Falling out of bed (900 confirmed deaths) Falling down the stairs (1,690 confirmed deaths) Big storm (874 confirmed deaths) Drinking binge (346 confirmed deaths) Of course, the statistic left out by the news Normal flu (36,000 confirmed deaths… read moreApril 20 2009
I got forwarded an addictive interactive sequencer yesterday (http://lab.andre-michelle.com/tonematrix) and was immediately hooked. I asked an internal mailing list if there was any kind of hardware that lets you do this kind of thing on the couch, and got the response -- “you mean MIDI?” That’s close, but it is closer to a… read moreMore Tied Variables in PowerShell
March 26 2009
Ibrahim just posted something to the PowerShell blog about how to create tied variables in PowerShell. If you extend this approach with script blocks, you have a very powerful dynamic scripting technique. PS C:\temp> cd \temp PS C:\temp> New-ScriptVariable.ps1 GLOBAL:lee { $myTestVariable } { $GLOBAL:myTestVariable = 2 * $args[0] } PS C:\temp> $lee PS… read moreWant to Influence the PowerShell Cookbook V2?
March 12 2009
We've started working on the next edition of the PowerShell Cookbook, and one obvious goal is to improve on the first version. As the first version has been in print, I've taken notes on where people get confused with certain recipes. I've taken notes on what I felt were content gaps, and… read moreWorkaround: The OS handle's position is not what FileStream expected
March 12 2009
If you have a PowerShell script that you are calling from cmd.exe, you might run into the following error: Write-Host : The OS handle's position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 code or another FileStream. This may cause data loss. This is… read moreMoving and Deleting Really Locked Files in PowerShell
February 17 2009
Once in awhile, you need to do brain surgery on files locked by the system. This is a common problem run into by patches and hotfixes, so Windows has a special mechanism that lets it move files before any process has the chance to get its grubby little hands on it. This can… read moreMaking Perfect Change with the Fewest Coins
February 10 2009
I've long wondered exactly how few coins you need in your pocket in order to perfectly round out any bill. I usually grab a handful and hope it works out. Even that mathematically astute technique sometimes leaves me a nickel or few pennies short, though, so I settle for making change that gets… read moreScripting WinDbg with PowerShell
February 04 2009
A while back, Roberto Farah published a script library to help control WinDbg through PowerShell. I’ve been using WinDbg for more debugging lately, and decided (after following one to many object references by hand) that I needed to script my investigations. PowerDbg is definitely helpful – Roberto has tons of great scripts published… read moreMore PowerShell Syntax Highlighting
February 03 2009
Vladimir Averkin recently wrote a series of posts that show how to export code with syntax highlighting into HTML and RTF formats. It works great in Outlook, but was causing Windows Live Writer to crash. The reason is that the HTML stream of the clipboard isn’t just a blob of HTML – it’s… read moreFebruary 02 2009
We frequently get questions asking, “Where can I get a PowerShell script encoder so I can write secure scripts like the Visual Basic Script Encoder?” The answer is that it is impossible to hide the password from the user if the script ever needs it. This is true of PowerShell, VBScript, C#,… read morePowerShell P/Invoke Walkthrough
January 19 2009
In version 1 of PowerShell, it was possible to access Win32 APIs in one of two ways: by generating a dynamic assembly on the fly (you wouldn’t really do this for one-off calls, but would probably do it in a script that makes it easier to invoke Win32 APIs,) or by looking up… read moreDateTime Casts are Language Primitives
January 13 2009
One thing that sometimes comes as a surprise (most recently as a comment on the PowerShell blog) is that DateTime casts are always parsed in the en-US DateTime format: Casting to a DateTime object doesn't respect the current culture of the thread. For example: > [Threading.Thread]::CurrentThread.CurrentCulture LCID Name ---- ---- 2057 en-GB >… read moreShould I Refinance? PowerShell the Financial Advisor
January 10 2009
When it comes to personal finance, research and reading sometimes can’t answer all of your questions. Especially when it comes to projecting the future, many subtle factors are simply too difficult to easily describe in rules of guidance. Because of this, they tend to be ignored. With interest rates sinking, now’s a good… read moreJanuary 10 2009
One bit of feedback we frequently get is that PowerShell's learning curve has some steeper bumps than we would like. Or simply, is strongly affected by habits learned from other languages or shells. Interestingly enough, many of these problems aren't new to us -- we just don't have a good way (aside from… read more