A Podcast about Windows PowerShell.
Listen:
Introduction
- Thanks to //o// and Kirk at Poshoholic for mentioning us on their blogs. We loved Kirk’s post about namespaces with the Star Trek references. That’s the Trouble with Tribbles!
News
- According to Bruce Payette in this post, details of PowerShell V2’s upcoming features will be released in November at ITForum!
- From [email protected]’ s blog: There is a new book titled “Windows PowerShell in Practice” that is being worked on by Jim Truher and //o//. It will be published by Manning and will cover topics such as, the PowerShell SDK (writing cmdlets, providers etc) advanced scripting techniques and domain specific examples.
- Citrix, Citrix, and more Citrix! Brandon Shell has gifted us with a veritable cornucopia of sixteen (16!) Citrix management functions such as:
- Get-CitrixFarm
- Publish-CitrixApplication
- Keith Hill and //o// will be a guest speaker in the first Windows PowerShell Virtual User Group Meeting (From Marco Shaw’s blog)
- Keith will talk about PSCX (PowerShell Community Extensions) and open source development
- //o//Â will talk about PowerTab
- October 3rd noon EST Online via Live Meeting 2007 (Microsoft is hosting so you need to use your Live ID)
- Phoul from the #Powershell IRC channel has a new blog up(http://insecure-complexity.com/). In his own words:
- “Especially to the new PowerShell users. I’m writing a blog that will be focused around my findings in my experience learning PowerShell. It will have scripts and tutorials and some neat tips n tricks after I get a little more acquainted with PowerShell. For now it has a profile example and a useful script for signing your scripts.”
Cmdlet of the week
- We were going to do Set-PSDebug but Hal didn’t do his homework. Instead, we gave the royal treatment to Get-Service!
Resources – Got a ton for ya this week:
- Keith Hill’s Blog series on Effective PowerShell – Item 1: The Four Cmdlets That are the Keys to Finding Your Way Around PowerShell . This article in particular is a must-read for all the PowerShell newbies out there. So far there are eight articles in the series, we highly recommend checking those out. Hal also mentioned the Mastering PowerShell in your Lunch Break series.
- PowerShellPlus
- Hal has put some screenshots up on his blog: http://halr9000.com/article/439
- Notable features:
- powertab & real intellisense
- pretty console features (transparency, bg image)
- command history (transcript)
- built-in editor w/syntax highlighting & intellisense
- snippet manager
- extensible w/powershell code
- variable & object explorer
- We don’t have an release date yet but Karl from PowerShell Live has said they are widening the closed beta to include their PS Analyzer customers sometime around Oct 1st.
- Quick Reference to AD cmdlets – on Dmitry’s PowerBlog
- IRC Channel: #Powershell @ Freenode network
- A series on Managing SQL with PowerShell (thanks $cript Fanatic)
Tips
- PowerShell is a scripting engine AND a shell
- Don Jones had an article about this in Technet (October Issue) when it comes out online it should be here
- Don Jones Technet article “Scripting One Line at a Time”. This talks about how you go about building a script based on the interactive nature of PowerShell
- $profile discussion part 2
- Gather your reusable bits into functions. Since they may be shared, be sure to comment them well.
- Categorize these functions by type.
- Organize each category of functions into a unique .PS1 file. I recommend prepending the filenames with “lib-” or similar.
- Place all the files in your profile directory, or on a file server, and dot-source them in your profile using something like this:
# place in your profile to load shared scripts
New-Psdrive -name Scripts -Psprovider FileSystem -root \serverscripts
Get-ChildItem Scripts:lib-*.ps1 | Foreach-Object { . $_ }
Powershell Moments
- Hal shares his frustration having to work with an NT 4.0 domain and how many ADSI queries don’t work against it, even if he uses the WinNT addressing scheme, as opposed to LDAP.
- Jonathan shares how easy the Quest cmdlets make it to “copy” users from one domain to another. His code was similar to this:
- Connect-QADService -service ‘domain.dev’
- $users – GetQADUser -SearchRoot ‘OU=Users,DC=domain,DC=dev’
- Disconnect-QADService
- Connect-QADService -service ‘domain.tst’
- $users | %{new-qaduser -name $_.Name -ParentContainer ‘OU=Users,DC=domain,DC=tst’ -SamAccountName $_.LogonName -description $_.description -displayname $_.DisplayName -firstName $_.firstname -lastname $_.lastname -UserPrincipalName $_.name}
One-liners
# extract part of a filename
dir | Foreach-Object { $_.name.substring(0,8) }
Gotchas
- From Poshoholic– If you convert any string to a boolean value in PowerShell, the resulting boolean value will be boolean True.  (With the exception of empty strings, which are $false.)
Powershell challenge
- Hal asked if anyone knows how to set SACLs on remote files. Not file ACLs but security auditing stuff. Turns out it might be much easier than he thought (using set-acl on a UNC path), but if you’ve got any code to share that’s great!
Thanks for listening! Keep the feedback coming, we really love hearing from you. Also don’t forget to write reviews and vote for us on iTunes, Podcast Alley and wherever else you may find us.