Hey, Scripting Guy! I have a script that returns the names of all the users in an Active Directory group. How can I sort those names in alphabetical order? — JW Hey, JW. Ah, yes, sorting data: the bane of script writers everywhere. Unfortunately, VBScript doesn’t have a built-in sorting mechanism, and neither does ADSI….
Year: 2004
How Can I Put New Users in the Same OU as the Person Creating Their Accounts?
Hey, Scripting Guy! We use a script to create user accounts. How can I modify this script so that it will place the new user in the same OU as the person running the script?– CB Hey, CB. Interesting question. We’re assuming that you’ve delegated control of Active Directory. User A, for example, has the…
Can I Use a Script to Determine the Size of a Folder on a Remote Computer?
Hey, Scripting Guy! Can I use a script to determine the size of a folder on a remote computer?– SS Hey, SS. Boy, you’d think you’d be able to do that, wouldn’t you? Especially if you’ve glanced through the WMI class Win32_Directory and noticed the property FileSize. Based on that, you might think, “Well, obviously…
Hey, Scripting Guy! Is There Any Way to Determine the Default Printer On a Computer?
Hey, Scripting Guy! Is there any way to determine the default printer on a computer?– JW Hey, JW. If you’re running Windows XP or Windows Server 2003, determining the default printer is easy. That’s because the WMI class Win32_Printer found on these versions of Windows includes a property named Default. As the name implies, this…
Can I Read an Entire Text File Rather Than Reading It Line-by-Line?
Hey, Scripting Guy! Right now I use a script to open a text file containing computer names. The script reads the first line of the file and connects to that computer, then reads the second line of the file and connects to that computer. Is there a way to store those names in a variable…
Can I Lock a Workstation Using a Script?
Hey, Scripting Guy! I know how I can shut down a computer using a script, and I even know how I can log a user off using a script. But is there any way I can lock a workstation using a script?– TO-R Hey, TO-R. Most likely you’re familiar with the Win32Shutdown method found in…
How Can I Tell If an OU Has Any User Accounts In It?
Hey, Scripting Guy! How can I tell if an OU has any user accounts in it?– RL Hey, RL. As a matter of fact, there is a way to determine whether or not an OU contains any user accounts: all you have to do is search just that OU for nothing but user accounts. When…
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…
Can I Create and Delete a DSN Using a Script?
Hey, Scripting Guy! Is it possible to create an ODBC Data Sources Name (DSN) on the fly and then remove it when done?– KC Hey, KC. Is it possible to create and then delete an ODBC DSN? To tell you the truth, we weren’t entirely sure. As it turns out, however the answer is this:…
Can I Use a Script to Rename All the Files in a Folder?
Hey, Scripting Guy! Can I use a script to rename all the files in a directory and include a “pl-” prefix plus the original file name?– JP Hey, JP. It’s interesting how many people need to do something similar: they need to rename all the files in a given folder, either by appending the date,…