As I’ve noted before, Microsoft really isn’t anything at all like its reputation. For example, we’re supposed to be the ruthless corporate bulldozer that simply crushes any human being that dares get in our way; in truth, though, we are probably the most politically-correct and overly-sensitive company in the history of the universe. Take our documentation (please!). In the Windows 2000 Scripting Guide, for example, I had a sentence that read something like this:
Learning to write scripts is no different than learning to play baseball: if you want to be good at it, you have to be willing to practice.
Not the exact sentence, but you get the idea.
So what’s wrong with that? Well, supposedly, soccer is the most popular sport in the world; therefore, I couldn’t use the word baseball. Why? Because soccer fans would somehow be offended. I was told it was OK to use the word soccer, but that didn’t make a lot of sense to me: after all, wouldn’t baseball fans then be offended? In the end, we just yanked the sentence altogether. (I mean, not that it was a great sentence or anything. It was just the principle of the thing.)
In another place in the book I said something along these lines:
In many respects, choosing a scripting language is similar to choosing a car: the model you pick depends on what you need to do. If all you need to do is get from Point A to Point B, then it probably doesn’t matter ….
I just realized that this could make for an interesting game show: For $500, tell me what is inappropriate about the preceding paragraph? If you said, “Nothing,” well, sorry, but we do have some lovely parting gifts for you. As was pointed out to me, not everyone in the world owns a car; therefore, we couldn’t use a car as an analogy. When I protested that even people who don’t own cars have likely heard of cars, the reply was, “Maybe. But you don’t know that for sure, do you?” Therefore, to avoid offending the one system administrator in the world who can still manage his or her Windows 2000 network despite having never heard of a car, we were supposed to remove this paragraph. (Did we actually remove it? To tell you the truth, I don’t even remember.)
As you might expect, it’s difficult to write a blog under these circumstances. Blogs, by definition, are supposed to be at least somewhat opinionated, but I don’t think the folks around here would be too thrilled if I started ranting and raving about the burning issues of the day. Therefore, I won’t bring up the fact that the
But although I have strong feelings about all this, you won’t hear a peep out of me. No, sir.
In the spirit of uncertainty surrounding the Huskies’ chances of going to the NCAA tournament (hopefully they’ll just win the Pac-10 tournament, and then the NCAA will have to let the Huskies in), I present a couple of scripts I’ve had lying around for years (I think they were originally written by my great-great-great-great-grandfather, and have been passed down through the family for generations). A long time ago, I somehow or another stumbled upon the Shell.LocalMachine COM class, and discovered you could write a script to get some interesting information about the local computer:
Set objComputer = CreateObject("Shell.LocalMachine")
Wscript.Echo "Computer name: " & objComputer.MachineName
Wscript.Echo "Shutdown allowed: " & objComputer.IsShutdownAllowed
Wscript.Echo "Friendly UI enabled: " & objComputer.IsFriendlyUIEnabled
Wscript.Echo "Guest access mode: " & objComputer.IsGuestAccessMode
Wscript.Echo "Guest account enabled: " & _
Wscript.Echo "Multiple users enabled: " & _
Wscript.Echo "Offline files enabled: " & _
Wscript.Echo "Remote connections enabled: " & _
Wscript.Echo "Undock enabled: " & objComputer.IsUndockEnabled
How useful is this? I don’t know, but some of it looks like it might be applicable to system administrators. (For example, off the top of my head, I’m not sure how else to determine whether or not offline files or remote connections are enabled on a machine.) This class also has a couple of methods that make it really easy to enable and disable the Guest account. For example, here’s a script that enables the Guest account:
set objComputer = CreateObject("Shell.LocalMachine")
And here’s one that disables the Guest account:
set objComputer = CreateObject("Shell.LocalMachine")
Are these the coolest bits of scripting code you’ll ever see? Hey, I don’t want to offend anyone, so I have no opinion whatsoever. They are what they are.
Here’s one I’m even less sure about. It tells you the name of the Passport account currently in use, as well as the member services URL for that Passport account:
Set objUser = CreateObject("UserAccounts.PassportManager")
Wscript.Echo "Current passport: " & objUser.CurrentPassport
Wscript.Echo "Member services URL: " & objUser.MemberServicesURL
What would you use something like this for? Well, that’s entirely up to you; my job is just to pass along crazy little tidbits of information like this.
And one final script, just for the heck of it. This one returns the name and Product ID (PID) for all the Microsoft applications installed on a computer. Useful or not useful? Hey, we report, you decide:
Set objMSInfo = CreateObject("MsPIDinfo.MsPID")
colMSApps = objMSInfo.GetPIDInfo()
For Each strApp in colMSApps
By the way, I think these are Windows XP-only scripts. I hope those of you who don’t have Windows XP aren’t too upset by this. If you are, feel free to complain; just get in line behind the soccer fans and the system administrators who have never heard of cars before.