Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Turn Off the Windows XP Service Pack 2 Firewall?

Hey, Scripting Guy! How can I turn off the Service Pack 2 firewall?-- JC Hey, JC. You know, if there’s a drawback to working at Microsoft (and if our manager is reading this we hasten to add that there are no drawbacks to working at Microsoft) it’s this: no matter what you do some people will be glad you did it and others will be … ...

How Can I Use a Logon Script to Remove All Mapped Drives?

Hey, Scripting Guy! How can I use a logon script to remove all mapped drives each time a user logs on?-- VS Hey, VS. You know, we’re glad you specifically mentioned the term “logon script” in your question. Why? Well, one of the drawbacks to mapping and unmapping network drives is the fact that there are no WMI classes capable of ...

How Can I Open Word with the Cursor Positioned at the Start of a Specified Line?

Hey, Scripting Guy! How can I open Word with the cursor positioned at the start of a specified line?-- PS Hey, PS. You know, we Scripting Guys have decided that we don’t like Microsoft Word anymore. How come? Well, as Scripting Guys we like to find solutions to seemingly-unsolvable problems: any time we can find a workaround for something...

How Can I Retrieve Just Audit Failures, Warnings, and Errors from My Event Logs?

Hey, Scripting Guy! How can I retrieve just audit failures, warnings, and errors from my event logs?-- OG Hey, OG. You know, just for the heck of it, we decided to check the event logs on one of our computers to see whether this was a task worth doing. In the Security event log on this machine we had 42,815 events; of those, just 286 were ...

How Can I Center Text in an Excel Cell?

Hey, Scripting Guy! How can I center text in an Excel cell?-- MV Hey, MV. You know, every now and then we get asked a question and we think to ourselves, “Wow, how many times do you suppose we’ve answered this question?” And, of course, when we go to double-check we find out that we’ve never answered that question; instead, it just ...