Out-Notepad

Maybe this isn’t the most earth shattering PowerShell function you’ll ever come across, but it saves me a few keystrokes. There are times when I want to see the results of  PowerShell expression but the console output is insufficient. I want to see the results in a text file opened in Notepad so I can easily scroll, search or whatever.

Continue reading

VBScript Training in Las Vegas

I will be doing a live 2 day VBScript class this fall in Las Vegas (Oct. 22 and 23). I’ll be covering ADSI, WMI, HTAs, WSF and more. This is a class for experienced VBScripters who want to take it to the next level. This is a hands on class with with labs and one on one attention.

This class is actually part of a week long training session. The rest of the week is PowerShell taught by PowerShell MVP (and my occasional co-author) Don Jones. You can take either my 2 day VBScript, Don’s 3 day PowerShell course or the full week.  If you take the full week you also get invited to a gourmet dinner which I’m sure will be a one of Vegas’ fine restaurants.

You can learn more and register at http://www.scriptingtraining.com/ILT/schedule.asp.

Technorati Tags: , , , , ADSI,

WSH and VBScript Core: TFM is here

I thought I’d take a moment to let you know that my new book is finally available. WSH and VBScript Core: TFM (SAPIEN Press). This book is a complete reference to Windows Script Host and VBScript. My goal was to replace the official Microsoft documentation with something that a Windows administrator would actually fine useful. The Microsoft documentation is pretty skimpy, in my opinion, and is aimed at developers. The examples rarely have any practical value and often are vague. So I decided to write the reference manual I wish I could have had when first starting out.

I cover every WSH and VBScript function, statement, object, property and method. Coverage includes the FileSystemObject, Dictionary and ScriptSigner objects. All the examples are complete and practical. If something doesn’t have a practical application in administrative scripting, I’ll tell you. I have to admit it’s a pretty exhaustive work. You can see the table of contents and download a sample chapter at http://www.sapienpress.com/WSHCore.asp.

The book is available at ScriptingOutpost.com, and Amazon.com (including Amazon.com.uk.) You can also purchase an e-book exclusively at ScriptingOutpost.com. The reference content is included in the WSH and VBScript help system in PrimalScript 2007 so you may not even need to buy the book. Although it looks great on your shelf!

I hope you’ll share your comments with me. I’d also appreciate any honest feedback you might share on sites like Amazon.

Thank you for your continued interest in my work.

Technorati Tags: , , , ,

Get Latest File

I was helping out in the MSN Groups scripting forum recently. The admin needed to find the latest file or most recently modified file in a folder. That sounded reasonable to me so I put together a function and short script that uses it. I thought I’d share it here:

The real “trick” to the script is to convert the DateLastModified property to a Date using CDate. Otherwise, the script tries to compare strings and you get some pretty weird and unexpected results. As written, this function will not recurse through subdirectories. Although you could make that modification.  It also searches all file types.  If you wanted to be more restrictive, say find the last Word document, you could either parse out the extension from the filename and only check .DOC or you could check the Type property of the file. This property will be something like “Microsoft Office Word 97 – 2003 Document”.

You could also modify this function to return all files that had been modified since a certain date. Here’s one possible modification:

 

Now you’ll get a comma separated list of all files that have been modified since 2/15/2007.

So kick it around. If you come up with some tweaks, post a comment.

Technorati tags: , , FileSystemObject,