Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

How Can I Make Changes to and Then Re-Save an Existing Excel Spreadsheet?

(image) Hey, Scripting Guy! How can I open an existing Excel spreadsheet, add some additional information to that spreadsheet, and then save my changes? Every time I call the SaveAs method a dialog box pops up asking me if I want to save my changes.-- RW(image) (image) (image) Hey, RW. Generally speaking, you can avoid that dialog box by ...

How Can I Show Users a Dialog Box for Selecting Files?

(image) Hey, Scripting Guy! Is there any way I can use a script to present a user with a dialog box and let him or her select a file?-- BF(image) (image) (image) Hey, BF. If you’re using Windows 2000, we don’t know of a way to do this, at least not a way that’s built into the operating system. That’s not the case with Windows XP, ...

How Can I Determine the System Time on a Computer?

(image) Hey, Scripting Guy! Is there any way to retrieve the system time as configured on a remote computer?-- JJ(image) (image) (image) Hey, JJ. There are at least two ways to do this, both using WMI. If you’re running Windows XP or Windows Server 2003, you can use the WMI class Win32_LocalTime. As you can see, that makes it pretty easy...

How Can I Retrieve Information From My Event Logs Regarding Unsuccessful Logons?

(image) Hey, Scripting Guy! How can I scan the event logs of my servers and return only information about unsuccessful logons?-- LC(image) (image) (image) Hey, LC. We’ll assume that you have enabled security auditing on your servers. If you haven’t, that’s step one. What you’ll want to do is - at a minimum - audit for logon event ...

How Can I Read Just a Single, Specified Line from a Text File?

(image) Hey, Scripting Guy! How can I read only a specific line in a text file? For example, how can I write a script that reads only line 16 in a text file and then stores the value of that line in a variable?-- DL(image) (image) (image) Hey, DL. You know we haven’t answered a question about text files in awhile, and that’s not ...