The Realm of the Verbal Processor

Jarvis’s Ramblings

16 Responses to “Vista Logon Scripts – Launchapp.wsf”

  1. Kevin said

    Do you know how to have the launchapp.wsf to schedule with “Highest Privileges”? I KNOW it’s a weird request, but it will fix a long, complicated problem that I’d rather not go into right now.

  2. Jarvis said

    I think the info you are looking for can be found on this page.

    That page says that to do this you need to set the runlevel property to “TASK_RUNLEVEL_HIGHEST”.

    I’ll let you figure out how to add that to the script. Once you get the answer, if you could post back what you find it would be appreciated!

  3. Kevin said

    Yeah, I found that page, and have been messing round for awhile. But, since I don’t really know VBScript, all I’ve added is this, following the format of other things in other examples:

    ‘********************************************************
    ‘ Set the principal for the task
    ‘********************************************************
    Dim principal
    Set principal = taskDefinition.Principal
    principal.RunLevel = TASK_RUNLEVEL_HIGHEST

    Or, instead of TASK_RUNLEVEL_HIGHEST, I think it may be 1. The former creates the task, the latter doesn’t, but neither actually have the checkbox marked for “Run with highest privileges.” If I could also just edit it to call from an XML file (which IS possible), would be great, but, even though I see the page on that site for it, I don’t understand it, and they give no examples.

  4. Jarvis said

    Yeah, I also had a hard time finding information on this as well. It is definitely not well documented…or at least not in such a way that those of us who don’t know what we are doing can do something useful!

  5. Kevin said

    Apparently that does work — however, it requires admin privileges now to run the script, which, of course, defeats the purpose. *sigh* Now if I could find the way to import an XML file, THAT might work.

  6. Kevin said

    Oh, and it works with the principal.RunLevel = 1, instead of TASK_RUNLEVEL_HIGHEST

  7. Joe said

    Jarvis,

    I am having a couple of issues with this. The code that you added to add the additional time to the taskscheduler requires the file MSSTDFMT.dll be present on the machine. This is not true of my installation. the second issue is that with this and with the sample script provided by Microsoft, the computer still prompts you twice when you login to tell you that it is scheduling the task and that the task has been scheduled. The drive mapping should be transparant at login.

    Any suggestions?

  8. Jarvis said

    I’m pretty sure (could be wrong) that “MSSTDFMT.dll” comes from one of the .NET Framework packages, so you might want to check that.

    I never got the prompts when scheduling the task…it was all silent. Sounds like something particular to your environment/setup that unfortunately I don’t have an answer to. But for that matter…if you don’t have the “MSSTDFMT.dll” file…how are you getting the script to run in the first place?

  9. Joe said

    I’ll try installing the .Net Framework packages. I imagine you are probably correct on this account.
    As for my environment, i’m running a test computer with a clean installation of Windows Vista Business using default settings loaded at installation.
    As for getting the script to run without the file, I commented out the section that adds the time to try and troubleshoot where the script was failing.

  10. Joe said

    The specific two messageboxes that I am getting are:

    Task definition created. About to submit the task…

    Task Submitted.

  11. Joe said

    Do you have any idea about the prompts now that I’ve given you some more specifics on my environment?

  12. Jon said

    As Jarvis said, it might be environment specific, but the easy fix is to just delete the two lines that start with wscript.echo, as those are what you use to output text in message box format with VBscript.

    On a side note, wscript.echo is an excellent tool when troubleshooting your login scripts as you can insert in places throughout your code so you can see where the code is going, what values are being held in variables, etc.

  13. Jarvis said

    Thanks Jon. I haven’t had time to look at the script myself this week, but after seeing your comment I remembered doing exactly that. I did have the message boxes that Joe mentioned initially, and commenting/deleting those lines in the script is exactly how I got rid of them.

    Great job chief!

  14. MrMMills said

    Hey Jarvis, I see you found my posts from 2007 at

    http://mcpradio.com/forums/forum_posts.asp?tid=3604&pn=1
    http://mcpmag.com/forums/forum_posts.asp?tid=3604&pn=1
    http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/Windows_Vista/Q_23844140.html
    http://www.freelists.org/post/gptalk/Vista-logon-scripts-launchappwsf-and-the-other-need-to-know

    I was trying to get the word out back then about Vista/Group Policy/and elevated tokens.

    I should have a copy of the the original launchapp2.wsf at home if you want to compare your script against it. Alot has happened since 2007 so I’m sure yours has added features. The benefit with launchapp2.wsf is that you could incorporate it into all needed GP scripts and it would work with both Vista and XP – so you wouldnt have to have seperate GPO’s for each operating system. I’ll see if I can find it and post it for you.

    Kudos – Thanks for writing the new article and the newer script! Keep it coming….

  15. Deepak said

    Hi Jarvis-
    I have gone through the above post that is recalls me an issue while executing the below vbscript:
    Vbscript to create a Schedule Task:-
    ————————————————————————————————
    Const TASK_TRIGGER_DAILY = 2
    Const TASK_ACTION_EXEC = 0
    Const TASK_CREATE = 2
    Const TASK_RUNLEVEL_HIGHEST = 1

    Set objService = CreateObject(”Schedule.Service”)
    objService.Connect

    Set objFolder = objService.GetFolder(”\”)

    Set objTaskDefinition = objService.NewTask(0)

    Set colTasks = objTaskDefinition.Triggers

    Set objTrigger = colTasks.Create(TASK_TRIGGER_DAILY)

    objTrigger.DaysInterval = 1
    objTrigger.StartBoundary = “2006-06-27T08:00:00-00:00″

    Set colActions = objTaskDefinition.Actions

    Set objAction = colActions.Create(TASK_ACTION_EXEC)
    objAction.ID = “Daily Task Test”
    objAction.Path = “C:\Windows\System32\sdclt.exe”

    Set objInfo = objTaskDefinition.RegistrationInfo

    objInfo.Author = “Administrator”
    objInfo.Description = “Test task that displays Windows Backup Status and Configuration tool daily.”

    Set objSettings = objTaskDefinition.Settings
    objSettings.Enabled = True
    objSettings.Hidden = False

    Set objSecurity = objTaskDefinition.Principal
    objSecurity.RunLevel = TASK_RUNLEVEL_HIGHEST

    objFolder.RegisterTaskDefinition “Test Daily Trigger”, objTaskDefinition, TASK_CREATE, , , 0
    ———————————————————————————————–

    Executing the above script prompts an error message:
    Error:Permission denied
    Code:800A0046
    Source: Microsoft vbscript Runtime error

    Can you please assist if we can create the scheduled task with the above code with any error message???
    Thanks in advance

  16. Jarvis said

    Sorry chief…I’m swamped…no way I can help with this. Maybe someone else who reads this will help you out.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>