Scripting Blog [archived]

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

How Can I Change a User’s Password?

(image) Hey, Scripting Guy! How can I change a user’s password using a script?-- GO(image) (image) (image) Hey, GO. You didn’t indicate whether you wanted to change the password for a local user or for an Active Directory user. But that’s OK: the processes are so similar we’ll go ahead and show you how to do both. It’s like ...

How Can I Determine if My Users Have Certain Files on Their Computers?

(image) Hey, Scripting Guy! Is it possible to search a computer for .MP3 files or other files my users aren’t supposed to have?-- AK(image) (image) (image) Hey, AK. Once again it’s WMI to the rescue. Using the CIM_DataFile class it’s easy to search a computer for specific file types. Want to know if your users have any .MP3 files ...

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

(image) 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(image) (image) (image) 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 you the amount ...

How Can I Count the Number of Lines in a Text File?

(image) Hey, Scripting Guy! How can I count the number of lines in a text file?-- MS(image) (image) (image) Hey, MS. It’s easy to tell that Microsoft’s scripting technologies weren’t written by people who do system administration for a living. Our scripting technologies are jam-packed with features and capabilities, yet we always ...

How Can I Automatically Run a Script Any Time a File is Added to a Folder?

(image) Hey, Scripting Guy! Is it possible to have a script automatically run any time a file is added to a specific folder?-- MB(image) (image) (image) Hey, WM. Yes, this is possible, thanks to the magic of WMI events, which allow you to write a script to monitor for something of interest (like a file being added to a folder) and then ...