Vista Logon Scripts – Launchapp.wsf
After switching to Vista (18 months ago…beta 2), I realized that my logon script wasn’t running anymore, but I didn’t really pay attention to it until this week…I’m needing to roll out Vista computers to some users at the office…so I need the logon scripts to work. In doing some research I found out why they don’t work. I won’t do a full write up of the reason, but basically it has to do with User Account Control and whether or not the user is a local admin on the computer. You can read a decent description of the issue here.
To get the logon script to work in this instance, you need to use a script named launchapp.wsf (scroll all the way to the bottom of that link) that you can get from the Technet site. That script is one that you use to launch your logon script. It schedules the script to run as a task as the interactive user. It works well…but there are a few issues that I read about and experienced personally.
First, launchapp.wsf does not work for an XP client. So…if a user logs in on a Vista computer and an XP computer…the logon script will work on one or the other…but not both. Or if you are using a GPO to assign your logon script, then it will only work for either XP computers or Vista computers.
Second, if you run multiple scripts (or the same script multiple times), the first will run, but the others will fail. This is because launchapp.wsf creates a scheduled task with a name of “Launch App As Interactive User”. It fails because it can’t create the second task with the same name.
So, I set out to fix those two issues. First, let me say that I am not a great scripter. I understand VBScript. I can write it…I’m not great, but I am adequate. One aspect of script writing that I am very good at is copying something that someone else wrote and massaging it to fit my purpose. That is what I did to fix these problems…a combination of massaging others’ code and writing some of my own.
To fix the issue of launchapp not working with XP, I added a section of code that determines the OS. If the OS is XP, it runs the logon script normally. If it is Vista, it runs it via scheduling the task.
Fixing the multiple scripts / multiple runs issue was more difficult. What I was able to deduce is that the issue is a missing setting in the original launchapp.wsf that you can copy off of the Technet site. Basically when the task is scheduled, it doesn’t expire. I dug through and found the property to set (EndBoundary). I set the script to make the task expire in two minutes. To do that I had to find a way of adding two minutes to the current time and format the date/time to fit the way that EndBoundary requires. Once adding that to the launchapp script, it wasn’t a problem.
You can download my modified version of Launchapp (PDF…my hosting provider restricts what kind of files I can upload…TXT is not one of them.). The pages that I used as reference material, or that I copied code from can be found here, here, here, here, here, here, here and here.
Let me know if it helps or if you have suggestions of how to improve it.
Immigration
On Tuesday of this week an Orange County Sheriff’s deputy was struck by a hit and run driver. He died from those injuries last night. His name was Michael Callin. He was 26 years old. He was the brother-in-law of one of my friends.
The early indications are that this driver intentionally swerved to hit the officer. The driver, Allan Barahona, has a rap sheet a mile long. Other passengers in the car told authorities that he intentionally hit the officer…because he didn’t want to be arrested.
What does this have to do with immigration? According to the news this morning, Barahona is an illegal alien. He is in this country illegaly. Aside from violating the laws of this country by simply being here illegally, he has also continued to prove that he cares nothing for the laws of this country evidenced by his rap sheet.
WHY IS HE STILL IN THIS COUNTRY????????? This kind of junk infuriates me. We have laws for this. Why are they not being enforced? He is an illegal alien. DEPORT HIM!!! If he is deported…he doesn’t have the opportunity to violate the other laws…or kill our deputies.
My quick and dirty solution:
1. Harden the borders…ASAP. Make is so that as much as we are able…you don’t get into this country unless you are supposed to get in.
2. Deport all illegal aliens. No discussion, no second chances. If you are here illegally…you are gone. Period.
3. Streamline the process for legal immigration. Make it a desirable process.