Scripting Blog [archived]

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

Hey, Scripting Guy! How Can I Map Drives Based on Membership in an Active Directory Group?

(image) Hey, Scripting Guy! I need to map a drive based on a user’s membership in a particular Active Directory group. However, I have a twist as well: I need to map a different drive depending on whether or not the user is a manager. In other words, I need to map a drive based on both group membership and job title. How do I do that?-- SA...

Hey, Scripting Guy! How Can I Remove Old Files From All the Folders That Share a Folder Name?

(image) Hey, Scripting Guy! We have a whole bunch of folders named Archive, all on the same computer. How can I search for all these folders, go through each one, and remove any files that are older than XX number of days?-- CH(image) (image) (image) Hey, CH. Well, it’s Day 2 of TechEd IT Forum here in Barcelona, and today’s the day ...

Hey, Scripting Guy! How Can I Use Windows PowerShell to Delete All the Files in a Folder Older Than 90 Days?

(image) Hey, Scripting Guy! In Windows PowerShell, how can I determine the number of days difference between two dates? I want to be able to delete all the files in a folder that are more than 90 days old.-- JN(image) (image) (image) Hey, JN. You know, today is October 31st and, in the US at least, it’s the day when the dark underworld ...

Hey, Scripting Guy! How Can I Move Files Based on a Value in the File Name?

(image) Hey, Scripting Guy! I have a bunch of files that I need to move to new folders; the folder a given file will be moved to is based on the year, a value that appears in the file name. How can I write a script to move these files?-- LP(image) (image) (image) Hey, LP. Before we launch into today’s column, we should clarify a couple ...

Hey, Scripting Guy! How Can I Map Drives Based on IP Address?

(image) Hey, Scripting Guy! I have been using your script that maps drives based on group membership, and it works just fine. However, I need to modify the script so that drive mappings are also based on the location of the computer (more specifically, on the computer IP address). For example, we have a remote site that uses an ISDN ...