Scripting Blog

A place to learn about PowerShell and share stories of automation

Hey, Scripting Guy! Quick-Hits Friday: The Scripting Guys Respond to a Bunch of Questions (01/23/09)

How Can I Return File Names of Files Created in Less Than an Hour from the Current Time? Hey, Scripting Guy! I am attempting to write a script that looks at the creation dates of all files in a certain directory. If the files were created less than an hour from the current time, the script will return those file names. The script will ...

Hey, Scripting Guy! How Can I Copy a File to a Removable Drive If I Don’t Know the Drive Letter of That Drive?

Hey, Scripting Guy! How can I determine if a computer has a removable drive attached to it and, if it does, copy a file to that drive? I have no way of knowing what the drive letter of that removable drive would be, assuming it even exists.-- SN Hey, SN. You know, when you live in Seattle you don’t really need a calendar in order to know ...

Hey, Scripting Guy! How Can I Verify That a User Entered a Valid Drive Letter?

Hey, Scripting Guy! How can I make sure that data entered into an InputBox has the form X:, where X is any alphabetic character? That’s important, because I need to use this string to map logical drives in a script. The script should validate any string such as D:, E:, or F: but flag as incorrect any string such as 9:, !:, 22: etc. I have ...

How Can I Create a Logon Script That Will Open a User’s Mapped Drives?

Hey, Scripting Guy! How can I create a logon script that will open a user’s mapped drives?-- KZ Hey, KZ. You know, a lot of people think we decided to write this column because we wanted yet another way to tell people about scripting. That’s partially true; however, another reason there’s a Hey, Scripting Guy! column is because the ...

How Can I Map Network Drives Based on a Computer’s Site?

Hey, Scripting Guy! How can I parse information in a text file, and then use that information to map network drives based on a computer’s site?-- BH Hey, BH. We’ll be with you in a second - we’re still replaying last night’s baseball game, in which the Kirkland Fire dropped a tough 7-5 decision to a very good team from Bothell. ...