One slick trick you can do in PowerShell with text files that’s difficult to accomplish without extra tools is to display sections of text files without showing the entire file. When you use the Get-Content cmdlet, the resulting content is treated as an array of strings. This means you can simply specify the line you…
Category: Scripting
Save on Advanced VBScript
Bookpool is having a huge sale on Microsoft Press books, up to 50% off. If you’ve been putting off getting a copy of Advanced VBScript for Microsoft Windows Administrators, it probably won’t get better than this. Bookpool has this title at 45% off. Plus I think they are offering free shipping on orders over $40….
Updated Logon Script Generator
Last fall I demonstrated an HTA I had developed to rapidly develop a user logon script with practically no scripting. You could map drives and printers based on group membership simply be selecting a group from a pre-populated drop down list. You could display a message to the user with information just as a summary…
PowerShell DBA
There is a very nice review of the new Powershell book at : http://weblog.infoworld.com/dbunderground/archives/2007/01/rtfm.html. I’m glad he likes the book, even though he doesn’t know who I am. But I’m working on it!! Anyway, the interesting point in his review is that he is looking at PowerShell from the perspective of a SQL DBA. In…
Windows PowerShell: TFM Out of stock
Amazon is again showing that Windows PowerShell: TFM is unavailable. Apparently they sold out of the initial order of books. Last I knew, SAPIEN Press was waiting for Amazon to place a re-order. Given the time it takes to ship books it could be a bit before Amazon gets re-stocked. If you can’t wait, remember…
Scripting Makeover Contest
SAPIEN Technologies is pulling out all the stops to put Windows automation at the top of everyone’s to do list. Or at least on the radar screen of the people watching the bottom line. They are running a Scripting Makeover Contest with very serious prizes. Here’s the official announcement which some of you may not…
Windows PowerShell: TFM Sample Scripts
If you have a copy of Windows PowerShell:TFM, you may want to get the sample scripts to test out. You can download a zip file of all the sample scripts from the book page at SAPIEN Press. Just scroll to the bottom of the page. You’ll also find a link to errata information. The book…
Powershell Parsing
In PowerShell, Get-WMIObject is a terrific cmdlet for remotely managing systems. If you have a text list of server or computer names, here’s a quick method you could enumerate that list and do something to each server. foreach ($server in (Get-Content s:\servers.txt)) {#skip blank lines if (($server).length -gt 0) { $server Get-WmiObject win32_operatingsystem -computer $server.Trim()}…
Powershell Help Examples
It may seem like a little thing, but the Get-Help cmdlet in PowerShell has some features you may not be aware of. I’m always using the -full parameter to see all the help information, primarily so I can see the examples. Well Get-Help has a -examples switch which won’t display syntax help, but it will…
Techmentor 2007 Orlando
Once again, I will be presenting at Techmentor in Orlando March 26-30. I’ll be doing sessions on ADSI, Batch files, PowerShell, and more. If you’ve never been, it’s a great time to get out of the office and learn a ton of real-world material that you can take back to the shop and put immediately…
Dec 31 Madness
ScriptingOutpost.com is having an end of the year madness sale on Dec. 31, 2006. All day December 31st, you’ll be able to save over $100 (30%!) on SAPIEN’s PowerShell Essentials Package. The package consists of: PrimalScript 4.1 Professional, Windows PowerShell: TFM, and the new Windows PowerShell Snippets Pack. Technorati Tags:PowerShell Scripting
Files on a diet
I did a MCPMag.com TipSheet column recently on compacting files to save space. I thought I’d take a moment to respond to some of the comments. First, today’s hard drives are enormous and drives are cheap. However, there are still plenty of 3 and 5 year old servers that need to squeak by for a…
Speak to me
Who says scripting is dull and boring?!? Set objSPVoice=CreateObject(“SAPI.SpVoice”)objSPVoice.Speak “I want to rock and roll all night, and party every day!” Technorati Tags:Scripting
Batch File Logs
I’ve always liked creating audit logs in my VBScript work, but could never figure out how to create a nicely formatted log from a batch file. Now I have. See http://sapien.eponym.com/blog/_archives/2006/11/20/2513469.html for the details. Technorati Tags:Batch Scripting
Script Development Best Practice
When creating new scripts follow this best practice advice before you write a single line of code and you will be ahead of the game. Technorati Tags:Scripting