PowerShell Team

Automating the world one-liner at a time…

Latest posts

Dec 29, 2006
Post comments count 0
Post likes count 0

Documenting TRAP and THROW

PowerShell Team

We pride ourselves about being a bit overboard when it comes to Error handling.  That is why our sparse (non-existing?) documentation of THROW and TRAP handling is both ironic and sad.  10,000 apologizes for that, we'll fix it in the next release.  In the mean time, it's Don Jones amd Jeffery Hicks to the rescue.  Don and Jeffery are the co-authors of Windows PowerShell: TFM.  The great thing about that is that they decided to "give you a taste" of the book so you can see whether you might be interesting in buying it.  It is our collective good luck that they made Chapter ...

Dec 28, 2006
Post comments count 0
Post likes count 0

Mandelbrot One-liner

PowerShell Team

WaiKin Wong sent me a Mandelbrot one-liner: $i=$j=$r=$x=$y=[float]-16; while(($y++) -lt 15) {for($x=0; ($x++) -lt 84; write-host (" .:-;!/>`)|&IH%*#"[$k -band 15]) -nonewline){$i=$k=$r=[float]0;do{$j=$r*$r-$i*$i-2+$x/25;$i=2*$r*$i+$y/10;$r=$j} while (($j*$j+$i*$i) -lt 11 -band ($k++) -lt 111)}" "} This produces the following results:   :::::::::::::------------------------------------------------::::::::::::::::::::::::::::::::--------------------------------------------------------::::::::::::::::::::::::----------------------------------;;;;;;;;;;;-------------------::::::::::::::::::-----------...

Dec 28, 2006
Post comments count 0
Post likes count 0

Editing your Profile file

PowerShell Team

$hay has a new scripting blog at http://scriptolog.blogspot.com/ .  His first blog entry Restart your engine - The PowerShell Way, talks about how he frequently edits his PowerShell profile file and then restarts his session.  In his directions he says: 2: type: Notepad $profile to open your profile file I looked at this and thought about my Philosophy of Automation post and thought, if you are editing your profile a lot, you ought to automate that.  I quickly typed Notepad $Profile and added the following to the end of my profile file function Edit-ProfileFile{   Notepad $profil...

Dec 27, 2006
Post comments count 0
Post likes count 0

PowerShell Essentials Package

PowerShell Team

A number of people have asked me about PowerShell IDEs and about how to get started with PowerShell.  Here is something to consider - Sapien is offering a special price on a package of components focused on PowerShell.  The package includes Tools (PrimalScript Professional), Snippets (reusable PowerShell code segments), and Learning (Don Jones' Windows PowerShell: TFM book [I can't wait to get my copy!]).  You can learn more about the package at: http://www.scriptingoutpost.com/ProductInfo.aspx?productid=PS1-CMB-01  Cheers! Jeffrey Snover [MSFT]Windows PowerShell/MMC ArchitectVisit the W...

Dec 27, 2006
Post comments count 0
Post likes count 0

Resolve to blog your automation

PowerShell Team

In response to my entry Philosophy of Automation, Tim Long blogged a response where he advanced the idea that people should make a New Year's Resolution to start a blog (if you have already).  That is a great idea.  I would follow on and further encourage you to set up a system to remind yourself at least once a week to make a blog entry (preferrable about something you automated with PowerShell :-) ).  Here is the concept: Once you write your first 30 blog entries, the next 300 will come easily.  With that concept in focus, figure out how you are going to get your first 30 blog e...

Dec 25, 2006
Post comments count 0
Post likes count 0

Send-SignatureToClipBoard

PowerShell Team

In my previous blog about the Philosophy of Automation, I encouraged everyone to share their automation even when it was small.  Here I'll follow that advice. I find myself doing quite a bit of blogging and commenting on other people's blogs.  I am often struck by the sorry state of blogging software.  I could go on for quite some time on that topic but the one thing I want to highlight is the issue of Signatures.  I have a signature that I use for all my entries.  I used to type it in each time but then I would get variations because I didn't remember it quite right and it was a pai...

Dec 25, 2006
Post comments count 0
Post likes count 0

Philosophy of Automation

PowerShell Team

 In my previous post about Boolean Values And Operators I made the following point: "PowerShell has a rich notion of TRUE/FALSE because it dramatically reduces the overhead and junk that you need to deal with when doing your work."  This philosophy flows from Whitehead's observation:   Civilization advances by extending the number of important operations which we can perform without thinking about them. Alfred North Whitehead, Introduction to Mathematics (1911)English mathematician & philosopher (1861 - 1947) Whitehead's point was really driven home to me recently.  Last week we&nb...

Dec 24, 2006
Post comments count 1
Post likes count 0

Boolean Values and Operators

PowerShell Team

John Smith asked what TRUE and FALSE were in PowerShell on our newsgroup Microsoft.Public.Windows.PowerShell.   The simple answer to this is $TRUE and $FALSE but the complete answer is a richer.  PowerShell has a very rich notion of TRUE and FALSE.  The best way to explain it is to show it.  PS>  function test ($VALUE) {>> if ($VALUE) {>>     Write-Host -ForegroundColor GREEN "TRUE">> } else {>>     Write-Host -ForegroundColor RED   "FALSE">> }>> }>>PS> test $TRUETRUEPS> test $F...

Dec 21, 2006
Post comments count 0
Post likes count 0

Jingle

PowerShell Team

As an attempt to spread some holiday joy, Satish Mathew and I wrote the following script.  Hope you enjoy it!  - Marcel Ortiz  ######################################################################################## $notes = write-output `  4A4 4A4 2A4        4A4 4A4 2A4        4A4 4C4 4F3 8G3             1A4 `  4Bb4 4Bb4 4Bb4 8Bb4     4Bb4 4A4 4A4 8A4 8A4    4A4 4G3 4G3 4A4    2G3 2C4 `  4A4 4A4 2A4&...