How Can I Determine the Percentage of Free Space on a Drive?

Hey, Scripting Guy! I know how to determine the amount of free space on a drive, but how can I determine the percentage of free disk space on a drive?– MS Hey, JP. You’re right: determining the amount of free disk space on a drive is pretty easy. For example, this simple little script tells…

8

How Can I Work with a CN that Has a Comma in It?

Hey, Scripting Guy! My user accounts have commas in their CN attributes; for example, Myer, Ken. How do I bind to those user accounts using a script? I always get the error message “An invalid dn syntax has been specified.” — GT Hey, GT. For those of you who don’t know, the CN attribute is…

8

Can I Pin a File to the Start Menu by Using a Script?

Hey, Scripting Guy! Can I pin a file to the Start Menu by using a script?– ZD Hey, ZD. For those of you who haven’t bought Windows XP yet (hey, what’s the matter with you; we Scripting Guys have families to feed!), by default XP’s Start Menu changes over time: the more you use an…

8

How Can I Password-Protect an Excel Spreadsheet?

Hey, Scripting Guy! In a previous column, you told us a couple different ways to save Excel spreadsheets. In that column, you said that one of the things you could do with the SaveAs method was password-protect a spreadsheet. However, you didn’t show us an example of this. How can I use a script to…

8

How Can I Display A Progress Bar (or Something Similar) While My Script Runs?

Hey, Scripting Guy! How can I get my script to do something interesting while the code executes; you know, how can I display a progress bar or something?– HD Hey, HD. To begin with, we don’t recommend that you try to use a true progress bar; that’s because it’s very difficult to calculate – let…

8

How Can I Get Just the User Name When Using the Win32_ComputerSystem Class?

  Hey, Scripting Guy! I’m using the Win32_ComputerSystem class to get the name of the logged-on user. The name comes back formatted like this: Domain\Name. How can I extract just the user name?– KW Hey, KW. As our much-beloved and highly-respected editor reminded us the other day, instead of spending all our time telling people…

8

How Can I Determine if a File Exists and, if It Does, Exit the Script?

Hey, Scripting Guy! How can I check to see if a particular file exists and, if it does, exit the script?– TO Hey, TO. There are at least two ways to check for the existence of a file (that’s the real key here; exiting the script is easy). One of these approaches uses the FileSystemObject…

8

How Can I Determine When a User Last Changed His or Her Password?

Hey, Scripting Guy! How can I determine when a user last changed his or her password?– MG Hey, MG. A long time ago one of the Scripting Guys worked at a local university. In one of the departments there it was easy to determine when a user last changed his or her password: that’s because…

8

How Can I Insert a Symbol into a Word Document?

Hey, Scripting Guy! How can I insert a Wingding symbol into a Word document?– RC Hey, RC. In case you’re wondering, there were two reasons why we decided to answer your question. First, we just liked the phrase insert a Wingding symbol. (No, we don’t know why we liked it, we just did.) Second -…

8

How Can I Read a Text File on a Remote Computer?

Hey, Scripting Guy! How can I read a text file on a remote computer?– BM Hey, BM. We have a confession to make: we’re using you and your question for our own nefarious purposes. Earlier this week we answered a question about reading the last line in a group of text files; in our answer…

8