Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Add a Web Site to the Trusted Sites Zone?

Hey, Scripting Guy! How can I add a Web site to the Trusted Sites zone in Internet Explorer?-- NR Hey, NR. As it turns out, trusted sites are actually stored in the registry; consequently, adding a Web site is simply a matter of creating and configuring a new registry key. For example, suppose you want to trust Microsoft.com. (And, really, ...

How Can I Use a Wildcard Character to Delete Folders?

Hey, Scripting Guy! How can I delete folders based on a wildcard character? For example, how can I delete all the folders whose name starts with December?-- RR Hey, RR. Well, that depends. If you’re running Windows XP or Windows Server 2003, you can actually use a wildcard character to identify and then delete all the folders whose name ...

How Can I Disable the Guest Account on a Computer?

Hey, Scripting Guy! How can I determine whether or not the Guest account is enabled on a computer and, if it is, disable it?-- PR Hey, PR. At last: a question for which there is a very simple, very straightforward answer. This isn’t to minimize the importance of the task: in general, it’s highly recommended that you disable the Guest ...

How Can I Change the Target of a Desktop Shortcut?

Hey, Scripting Guy! How can I change the target that a desktop shortcut points to? For example, if I move a file from one server to another, I’d like be able to use a script to change the shortcut that points to that file.-- AK Hey, AK. This is an example of a scripting problem that’s actually pretty easy to solve, provided you know ...

How Can I Find and Replace Text in a Text File?

Hey, Scripting Guy! From the command line, how can I use a script to open a file and replace text; for example, how can I replace all instances of “Jim” with “James”?-- JW Hey, JW. As we’ve found out numerous times when dealing with text files, there is no obvious way to do this; that is, there is no ReplaceText command that can ...