A Podcast about Windows PowerShell.
In This Episode
- Lots of news and tips
- We missed Jonathan
- Our first contest–with actual prizes!
News
- The PowerShell team blog brings us the news that “PowerShell continues to win awards with Redmond Magazine’s 2008 Editor’s “Slickest Time Saving Tool” co-winner to go along with PS’s Best of Tech-Ed Attendees award and Best of Tech-Ed Client awards.”
- Kirk Munro covers PowerGUI on DNR.tv .NET Rocks! and RunAsRadio.
- Karl Prosser (admin frameworks MVP and PowerShell Analyzer architect) was interviewed on the “A Couple of Admins” podcast Episode 35. The interview lasts for almost an hour and I really enjoyed it.
- Shay@Isreal (The $cript Fanatic blog) put together a cool PowerShell toolbar
- Admin Frameworks MVP Brandon Shell was interviewed on the CS Techcast podcast. Hal listened to it on the way home the other day and he thought it was a really good interview.
- VMware’s VI-Toolkit open beta is expected in March
- Over 70 new cmdlets
- This example would create a snapshot of every VM:
get-vm | new-snapshot
- Dale Lane, author of the IBM Websphere MQ PowerShell snapin is considering writing another tool, this time a PowerShell library for the IBM DB/2 RDBMS. He is seeking feedback, so if you or someone you know might be interested, please visit this blog post and leave feedback.
- New Video Podcast: PowerShell-Basics.com
- This is created by Steve from the A Couple of Admins Podcast. He wanted to create a screencast-only video podcast. His first show should be out by the time you hear this.
Tips
There’s a ton of Scripting Guys stuff we meant to cover in the interview show last time that we never got around to:
- PowerShell Graphical Help (which we’ve mentioned before)
- PowerShell Scripting Toolbox
- Tons of categorized examples in their script repository
- “Hey, Scripting Guy!” help columns on the website and in Technet Magazine
- And here’s a link to the Scirpitng Games we talked about in the last show.
This was used as part of a script Jonathan helped a co-worker with to batch sign ActiveX controls. Thanks to Joel for help on this one.
[Diagnostics.Process]::Start("cmd.exe","/C $robocopycmd")
Hal talks about renaming multiple files which end in an underscore:
$files | %{ Rename-Item -Path $_.FullName -NewName ( $_.Name -replace '_$' ) }
Jonathan talks about grabbing just the first few lines of a huge log file:
get-content *.log -totalCount 5
Hal parried, then riposted with:
get-content | select-object -first 5
PowerScripting / A Couple of Admins Cmdlet Contest
Contest Rules:
- Three cmdlets announced on each show.
- Contest entries will be a PowerShell script using all six cmdlets.
- Entries can be submitted to contest@acoupleofadmins.com
- Submissions will be taken until February 14th
- Two winners will be drawn from the entries – one random, one for best script as decided by Steve, Hal, and Jonathan.
- Prize – commercial license for PowerShell Analyzer (donated by Shell Tools)
- Prize – commercial license for the NetCmdlets (donated by /n Software)
What are the cmdlets? You have to listen to find out.
Thanks again to all of you listeners out there! Your feedback makes it all worthwhile, keep that rolling in. Our email address is powerscripting@gmail.com, or you can comment on this very blog post. Also find us on Facebook here (Jonathan), here (Hal), and here (PowerScripting Podcast group). Our group needs more members! The Scripting guys are ahead by a teensy bit.
CLICK HERE TO SUBSCRIBE!
Listening to your oneliner, I noticed that you used a foreach as rename-item supports scriptblocks as parameters (* Sound like nice topic *hint* )
in your case :
$files | %{ Rename-Item -Path $_.FullName -NewName ( $_.Name -replace ‘_$’ ) }
to :
$files | Rename-Item -Path -NewName {$_.Name -replace ‘_$’ }
I have some more info about this on my old blog here :
http://mow001.blogspot.com/2006/11/powershell-advanced-renaming-of-files.html
Greetings /\/\o\/\/
Oops also leave out -Path
$files | Ren -New {$_.Name -replace ‘_$’ }
Greetings again
/\/\o\/\/
Thanks as always Mow!
Hi Fellas ,
Great Podcast . Would you have any more info on auto-it . You were saying how to interact with a Dialog window ? Is this in Bruce’s Book ?
Thanks
Chris
Chris,
Glad you mentioned AutoIt. You may have heard Lee Holmes talking about using AutoIt with PowerShell in the latest Powershell Virtual Users Group videos (http://marcoshaw.blogspot.com/2008/02/windows-powershell-virtual-user-group-3.html). He said he’ll be releasing code to the public soon. We’re watching for that, and it will definitely be a topic on a future show, I promise. I was very interested myself in the concept.
Also, SendKeys and AutoIt are mentioned in this newsgroup thread: http://tinyurl.com/2zhp49
Good show guys.. keep up the good work!
One quick note about [Diagnostics.Process]. You can overload the constructor as you did with two arguments as strings, or you can pass in a StartInfo object, which includes the command, arguments and a bunch of other options as well.
$exe = outlook
$parameter = ‘/safe’
$startinfo = new-object System.Diagnostics.ProcessStartInfo
$startinfo.FileName = $exe
startinfo.Arguments = $parameter
$process = [System.Diagnostics.Process]::Start($startinfo)
Check out the members for StartInfo
You can do things like redirect standard output and standard error. You can also hide the window of the process, so if you wanted to run a cmd command without anything popping up, you can. You can also specify a username and password.
Look for a blog entry on this coming soon
Thanks!
Andy
http://www.get-powershell.com
[...] Function Start-Proc Posted on February 22, 2008 by Andy The gentlemen over at the Power Scripting Podcast recently posted a tip on how to start processes in [...]