PowerGUI & PowerShell Script Repository
Scripting July 28th, 2008
Now this is COOL!
Joel “Jaykul” Bennet maintains the PowerShell Script Repository, which is also linked to PowerShellCommunity.org.
Now, the script editor in PowerGUI can search the PowerShell Script Repository.
I just tried it and searched for a script to send email. I searched for mail and found three matches, chose the one I wanted, clicked on it, and it appeared in my script editor. Nice!
Thanks to Dmitry and Kirk at Quest for this great community resource.
Marco Shaw Presenting on /n NetCmdlets
Scripting July 23rd, 2008
Marco Shaw (of the Get-PowerShell Blog) will be presenting to the UK Users Group about /n Software’s NetCmdlets.
Check it out, as /n Software has a number of cool cmdlets for working with network protocols and has a product under development for tunneling PowerShell over SSH.
Details of the presentation are here.
Sysadmin/Scripting Meme Update
Career, Geek Stuff, Scripting June 18th, 2008
I talked about it a bit when we recorded Episode 55 (soon to be released), but the Sysadmin Meme has really taken off. Admins and scripters from all areas are responding and calling out their associates… I’ll update this as I see come across more.
In no particular order:
- Shay Levy
- Hal Rottenberg
- Marc van Orsouw
- Richard Siddaway
- Rolf Masuch
- Andy Schneider
- Jacob Saaby Nielsen
- Paul Muller
- Jonathan Noble
- James O’Neill
- Kirk Munro
- Jeff Hicks
- Rick Savoia
- Darren Mar-Elia
- David Moisan
- Paul Sylvester
- Joel Bennet (Jaykul) - taking it back on the dev track
- Oisin Grehan
- Joe Richards
- Brandon Shell
- Don Jones
- Greg Shields
Thanks again to everyone for sharing their stories!
Keith’s SysAdmin Meme
Associations, Career, Geek Stuff, General Interest, Scripting, Special Topics June 16th, 2008
OK, here it goes.
How old were you when you started using computers?
I was around 12 or 13 when I started playing with computers. I saw them in Popular Science and was fascinated with them. I then pestered my parents for my first PC for Christmas and my dad finally took me to K-Mart where I had to choose between the Texas Instruments TI/99-4A, the Timex Sinclair 1000, and either the Commodore Vic-20 or C-64.
What was your first machine?
My first computer was a Timex Sinclair 1000. I remember my friend getting a Commodore and being jealous of the color graphics. My second and real springboard PC was a Radio Shack/Tandy TRS-80 Model 4 with 64 kb RAM and dual 5.25 floppy drives (360k each!) We had Tandy TRS-80 Model II and 3’s in my school district so I went with what I knew. My dad had IBM PC’s at work and showed me an ad for an IBM (Peanut, I think) and I decided to stick to the Radio Shack brand. I still have both of these units somewhere in my parents attic….along with all the other old stuff I’ve talked about on the show. My first x86 PC was a Bondwell B210 286 laptop with a 40 MB hard drive.
What was the first real script you wrote?
Hello World loop in Basic on the Timex Sinclair 1000……Isn’t that what everyone writes? I went on to write an inventory control system in BASIC for the company my dad worked for. I coded on the TRS-80 and then printed it out. A typist transcribed my code onto an IBM PC and then I came in to troubleshoot the problems. No reading floppies cross-platform in those days. There were subtle differences in the BASIC compilers back than for disk I/O and file handling. Sadly, this old geek can still remember that BASIC stood for Beginners All-purpose Symbolic Instruction Code.
What scripting languages have you used?
Basic (No, not visual), Pascal, COBOL, and Fortran. Pascal will always be my favorite. Top down design rocks. If you haven’t declared it….you can’t freakin’ call it. That’s probably why I’ve had so much trouble grasping the object-oriented languages. Later on into today, it’s been DOS batch file scripts, SQL, Kixtart, and the occasional dabble into PowerShell.
What was your first professional sysadmin gig?I took a part-time job in 1987 doing data entry for free magazine subscriptions (International Computer Network) while going to community college for Comp Sci. When they found I had a tech bent, they started using me to do after-hours system tasks on the two mainframes we had (Tandem System I and Tandem System II). Load tapes for backups, load printers for labels or other print jobs, etc. The one thing I remember is the wide carriage printers in the data center. Before each type of print job, I had to run a paper tape with a series of holes punched in it through a reader on the printer. This would set up the printer for the type of job to be printed.
If you knew then what you know now, would have started in IT?
Definitely. During my college years, after I gave up on programming as a major, I focused on being in the financial markets. After a couple of years, however, things changed and I took on MIS as a second major and veered back towards IT. Mostly the change was in the industry. I wasn’t cut out to be a programmer locked in a hermetically sealed mainframe room, but that was the only college curriculum at that time. Once MIS and broader IS/IT curriculums came around it fit me better.
If there is one thing you learned along the way that you would tell new sysadmins, what would it be?
Everybody knows something you don’t. Talking to them and asking them is the only way to find out what it is. In return, share everything you know. Nothing is more counterproductive than having knowledge and not sharing it.
If I could add a second item, it would be; Nobody knows everything. If you think you do, it is time to get out of this field. You need to enjoy constantly learning new things because this is an ever changing field.
What’s the most fun you’ve ever had scripting?
I guess the scripts I am most proud of are the ones I did for Y2K at my old job. They had these old scripts using this Novell Netware add-on pack that allowed them to transfer files between a Novell NetWare server and a SCO Unix server. The Add-on pack was not Y2K compliant, so I replicated the scripts using FTP and DOS batch files. There are only one or two facilities still using these scripts, but thy are still there 10 years later.
Who am I calling out?
Paul Rj Muller at the Caffination Podcast
Justo Morales at the Pepe Show Podcast
Rick Savoia of the The Force Field Podcast
UPDATE: Paul and Rick have both responded. I’ll have to reach out to Justo and kick him in the asterisk. You can find Paul and Rick’s responses at the following links:
Scripting/Sysadmin Meme
Associations, Career, Geek Stuff, General Interest, Scripting June 10th, 2008
I’ve found a Software Development Meme (A meme consists of any unit of cultural information, such as a practice or idea, that gets transmitted verbally or by repeated action from one mind to another) on a few blogs I’ve started reading (Larry Clarkin’s and Damon Payne’s), and I thought I would adapt it to the Sysadmin.
How old were you when you started using computers?
I was eight when I first started using computers. My mom was a teacher for the local public school system and they were just getting computers. She could bring one home over the summer and I started learning Basic on an Apple II.
What was your first machine?
The first machine we had in our family (other than the ones my mom could bring home) was an Apple II GS. My first machine was a 486 IBM clone that cost me $2,000 (in 1993) (my summer work money - I was in high school).
What was the first real script you wrote?
The first “real” script I wrote was a Python script to enter addresses into a database system via ADO.
What scripting languages have you used?
I’ve used VBScript (marginally), PowerShell, and Python.
What was your first professional sysadmin gig?
My first professional sysadmin job is the one I currently have, with a local law enforcement agency. I started officially as the IT Specialist here in April of 2006.
If you knew then what you know now, would have started in IT?
Definitely. If I knew then what I know now, I would have finished college in the IT realm and started down this path sooner. However, that might have changed how I’ve ended up, and I really like the position I have now and the opportunities in front of me.
If there is one thing you learned along the way that you would tell new sysadmins, what would it be?
Get involved. I’ve learned more and met more great people getting involved in community. By commenting on blogs, podcasting, spending time on IRC in the #powershell channel and participating in PowerShellCommunity.org, I have learned so much and met generous, knowledgeable people.
What’s the most fun you’ve ever had scripting?
The 2008 Winter Scripting Games were a blast, even though I got busy with work halfway through, I had a great time. It was awesome watching the community provide their solutions and see people working on the challenges in the IRC channel and forums.
Who am I calling out?
Rich Niemeier
Keith Albright
PoShMon for PolyMon is available!
Scripting April 8th, 2008
Recipes? This ain’t stone soup were makin’!
Podcast, Scripting December 14th, 2007
Recorded: November 29, 2007
Your Hosts: Steve Murawski, Rich Niemeier, and Keith Albright
Show Length: 59:11
A while back on our blog, I posted a review for the Windows PowerShell Cookbook from O’Reilly Press. Lee Holmes, the author, responded to my review and, when I asked if he would do an interview for the show, he agreed. We talk a bit about PowerShell, about his book, and the PowerShell community. It is interesting to hear first hand from one of the developers on the PowerShell team who has not been featured on any other podcast (that I’m aware of).
Links mentioned in this show:
Precision Computing - Lee Holmes’ blog
Forcing Windows Updates with PowerShell
Patches, Scripting December 10th, 2007
Lately, I have had to set up a number of computers from scratch (I know, I know, I should have updated my base image, but I didn’t…). As I was setting up the computers, I wanted to make sure their patch level was current.
Going to Windows Update (Microsoft Update) showed around 91 updates to download. I said to myself, “Self, I already downloaded all these updates to my Windows Server Update Services server. Isn’t there an easy way to make this computer update from there?”
In my environment, the location of the computer determines what Organizational Unit it is in my Active Directory, which in turn, says when it is scheduled to download updates.
A short Google search later, and I found a batch file which will cause a client computer to check with a local WSUS server (or MS Update if there is not an assigned local server) at Patchaholic - the WSUS Blog!
Since I’m a PowerShell fan, I though I should translate this simple batch file to PowerShell (and give it a more PowerShelly name).
#* FileName: Invoke-WindowsUpdate.ps1
#*================================================================
#* Script Name: [Invoke-WindowsUpdate]
#* Created: [12/10/07]
#* Author: Steven Murawski
#* Company:
#* Email: steve@acoupleofadmins.com
#* Web: http://www.acoupleofadmins.com
#* Reqrmnts:
#* Keywords:
#*===============================================================
#* Purpose: This script will force a computer to check for updates from
#* Microsoft Update or a local WSUS Server. This script is the
#* PowerShell version of the batch file found at Patchaholic - The WSUS Blog
#* http://msmvps.com/blogs/athif/pages/66375.aspx
#*===============================================================
Write-Host “This PowerShell script will Force the Update Detection from the AU client:”
Write-Host “1. Stops the Automatic Updates Service (wuauserv)”
Write-Host “2. Deletes the LastWaitTimeout registry key (if it exists)”
Write-Host “3. Deletes the DetectionStartTime registry key (if it exists)”
Write-Host “4. Deletes the NextDetectionTime registry key (if it exists)”
Write-Host “5. Restart the Automatic Updates Service (wuauserv)”
Write-Host “6. Force the detection”
Read-Host “Press enter to continue”
# Stop the local Windows Update Service
Stop-Service wuauserv
# Set the location of registry key
$AutoUpdate = “HKLM:\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update”
# PowerShell allows you to navigate the registry like a drive
# The various registry hives are like drives, the keys are like files
# and their values are shown as properties.
# The switch statement below checks to see if any of the values below are set and deletes them
# if they are present.
switch (Get-ItemProperty $AutoUpdate)
{
{$_.LastWaitTimeout} {Remove-ItemProperty -Path $AutoUpdate -name LastWaitTimeout}
{$_.DetectionStartTime} {Remove-ItemProperty -Path $AutoUpdate -name DetectionStartTime}
{$_.NextDetectionTime} {Remove-ItemProperty -Path $AutoUpdate -name NextDetectionTime}
}
# Restart the local Windows Update Service
Start-Service wuauserv
# Call the command line client to check for new updates
wuauclt /detectnow
Write-Host “This AU client will now check for the Updates on the Local WSUS Server.”
Read-Host “Press enter to continue”
Translating this script was good, as it allowed me to work hands-on with the registry through PowerShell, which I had not yet had an opportunity to do.
Book Review: Windows PowerShell Cookbook
Scripting November 20th, 2007
Windows PowerShell Cookbook by Lee Holmes is the latest in the Cookbook series by O’Reilly Publishing. I have been a huge fan of the Cookbook series of books. The Cookbooks are set up in the Problem/Solution/Discussion format, where the author proposes a common problem, shows a code/configuration solution to that problem, and then discusses why/how this solves the problem.
The Cookbook series has covered many technical topics and, in my opinion, covered the topics quite well. My current favorite is the IOS Cookbook, which set the bar quite high for the level of content for this series.
When I heard that there was going to be a Cookbook focused on PowerShell, I eagerly watched for it to appear on the bookshelf at my local bookstore (and to be available online). My first impression was that, for an O’Reilly Cookbook, it was rather skinny (584 pages). Being skinny does not doom a book to being a poor resource, so I picked it up and began to read.
In scanning the table of contents, it appeared that the book covered a wide array of common, not-so-common, and quite interesting tasks. After five minutes of reviewing the enclosed scripts and instructions, I was extremely disappointed. While the problems covered a good amount of ground and the scripts to solve the problems were elegant (better than anything I could come up with), the discussion was lacking.
In the IOS Cookbook, one could gain a working understanding of many of the protocols, services, and features offered in Cisco devices through the discussion portion of the solutions. I did not see that same ability reflected in the Windows PowerShell Cookbook.
The most disappointing to me was the coverage of how to create a PowerShell Cmdlet and how to add PowerShell scripting to your own programs. While Mr. Holmes provides examples of how to do each of the tasks, the discussion could be summed up as “check out the SDK documentation”. The book would have been better if he had not broached these topics.
The Windows PowerShell Cookbook will stay on my shelf as a reference book (for the code samples), but I would look to other resources first (e.g. Windows PowerShell In Action by Bruce Payette), if you need a resource to help learn PowerShell.
If you have read this book, please let me know what you thought.
Powered by ScribeFire.
Secure Delete
Automation, Desktops, General Interest, Scripting, Security October 29th, 2007
I caught this one recently on an episode of CyberSpeak (10/15 show)…..
There are a lot of “secure” file deletion applications out there, but these two look quick and simple and can be used on-the-fly from a thumb drive or automated in a script.
SDelete from Sysinternals/Microsoft
Cipher (included with Windows 2000 and above)
Assuming you do the right thing and migrate all of your confidential data to an encrypted TrueCrypt volume, what do you do with the old copies of the data? You can securely erase the data using these tools so that the only recoverable copy is in your encrypted volume.
Some systems use a data interchange folder to integrate two disparate systems. One system will drop an export file in the directory and the other system will import the file from the directory. I’ve seen POS systems integrate to credit card processing systems in this manner. With this tool, you can script a cron job to regularly securely delete the interchange files in the directory.
Just another layer of security to consider.




