Scott Hanselman

DNRTV Screencast - Powershell is still shiny

September 12, 2007 Comment on this post [7] Posted in Musings | PowerShell | Screencasts | Tools
Sponsored By

The string of unscripted DNRs (I hope you don't mind) by Carl and I continued. Last week during lunch, Carl and  I recorded an episode of "DotNetRocks TV" where I continue to try and convince Carl that Windows Powershell is a goodness. This is  Episode 82 of DNRTV. 

If you're not using Powershell yet, why not? I hope this show helps to convince you of its usefulness, or at least give you an idea of why I love it so much.

Play Flash Version in the Browser
Download zipped video
Download Torrent to Zip
Subscribe

Be aware if you download the ZIP that it's about 200megs. The show is in two parts, so there's an advertisement in the middle of the show...after that advert, Part 2 will automatically start. I encourage you to check it out the ad, first because it's telerik and they sincerely rock, and second because our sponsors pay for the massive bandwidth bills for the direct downloads.

If you like DNRTV, and want to subscribe to the DNRTV Feed, consider using the RSS Downloader features of µTorrent ("microtorrent").

I hope you enjoy the show.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
September 12, 2007 15:17
Ok *Now* I'm starting to get it...

It started to click during the last third of this DNR.

Don't stop there though.. More DNRTV for Powershell.

"Do you want you know more?".....Hell yes :)
September 12, 2007 23:26
Oh, I'm using powershell. It freaking rocks!!
Ben
September 13, 2007 2:19
I'm starting to use PowerShell for my automated build stuff. Being able to use .NET Framework is huge.
September 13, 2007 4:06
I had tried PowerShell on multiple occasions, but it tooks me a while to really get into it until I really had a need for it and until I saw your DNRTV. Today, I made a real good use of PowerShell, that is to call PowerShell script from Ruby. Sending email is so easy from .NET Framework classes under System.Net.Mail, so I knew I could write email sending code easily in PowerShell. But my main scripting for Watir is obviously in Ruby, so I wanted to call the PowerShell script from Ruby. Well, it was really easy... I just did the following.

system('powershell C:\Scripts\MyPowerShellScript.ps1 you can pass args optionally')

The output gets sent to the Ruby console and all is good. Since you can pass arguments to PowerShell scripts and catch them using $args varible, integrating Ruby and PowerShell may be quite an easy job.

Here is what I did.

$logFilePath = $args[0]
$smtp = new-Object System.Net.Mail.SmtpClient("MyEmailServer")

$msg = "Smoke Testing has completed at " + [System.DateTime]::Now.ToString()
$emailMsg = new-Object System.Net.Mail.MailMessage("from@whatever.com", "to@whatever.com", "Smoke Testing Finished", $msg)
$attachment = new-Object System.Net.Mail.Attachment($logFilePath)
$emailMsg.Attachments.Add($attachment)
$smtp.Send($emailMsg)
Write-Host("Email has been sent")
September 13, 2007 21:46
I have two reasons for not using PowerShell myself.

First, it is firmly bolted to .NET and that's fine in a lot of cases, but I want to post scripts and tips that can be used on any currently-supported Windows platform without requiring .NET. So, for me it is cmd.exe and .bat and if not that, then WSH (not to be confused with WHS), JavaScript, and even that raises issues about script blocking, AV tools, and people who carefully avoid hosted JavaScript on the platform, whether or not in the browser. (I will use accelerator features in products like 4DOS and 4NT, that make operating in a console shell much easier and slicker, but I will confine myself to .bat files for scripts I use and distribute to others.)

Secondly, although I've seen claims that it's based on some established Posix principles and standards, PowerShell is a very weird language from my point of view. It may be a lot of fun and powerful, but somehow it just doesn't get my aesthetic juices flowing. So I haven't found a good reason to go over the learning hump. That's probably my age showing. I've concluded that I must have only one geek chromosome rather than the two that was present in so many guys at last night's nerd dinner (which was a lot of fun, just the same).

Finally, I'm answering your question without listening to the 'cast. I will now remedy that while I prune through unread blog-feed articles that piled up while I was out all day yesterday.
September 13, 2007 22:15
FREAKED ME OUT!!

Oh, ok. Well, I hadn't watched dnrTV before and I didn't realize what would happen. So I hear people talking and oh, there goes the podcast, I think, but why is my browser opening up instead of media player or something and then ... Oh my gosh, they are pushing some windows download to my computer .... !!

OK, you got me. It was the screencast and you were showing Carl the PowerShell download (running as admin all the time too, huh?) but I thought your site had been hacked and I was being social-engineered to click Run! Heh, heh. No kidding.

All right, all right, that's very impressive. I'm impressed with how you used PowerShell and Power Tab.

And I'm even more impressed with that screencast technology. How do I make those? That interests me even more. OK, going to the search panel now ... you must have talked about this somewhere in wayback ...
September 15, 2007 8:07
orcmid - That's camtasia and a REALLY REALLY good microphone. I'm in Oregon and Carl is in New England. Also a good editor, Carl's Brother.

Update - When I was trying to get tab expansion on a custom loaded DLL, turns out all I needed to do was Update-TabExpansionTypes to get it. Thanks MoW for the correction!

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.