4 Replies Latest reply on Sep 20, 2009 10:54 PM by ecoidan

    Can startasuser.exe be used in localsch?


      I have a script that needs to run on a schedule but the script touches another machine via UNC.  When it runs out of localsch, the result is "Access is denied.".  I have confirmed this by running the following command -


      localsch.exe /exe=%ComSpec% /cmd=/K


      This lauches a command window running in the context of the Intel Local Scheduler Service which is configured to log on as Local System account.  I can then run the script and see the error messages that are displayed.


      Can startasuser.exe be used in a localsch task or is that program only useful in the context of software distribution?  Are there any other work arounds to make a localsch task run in user context?



        • 1. Re: Can startasuser.exe be used in localsch?
          Tom Farrugia SupportEmployee

          You definitely can use startasuser wth the local scheduler.  Below is a line I inserted into the NTSTACFG.IN# to run a visible virus scan as the currently logged in user.  This utility will be more needed as we manage more and more Vista workstations.  I ran as the current user because the task had UI, displaying the scanning process.  In Vista, if a program launches UI under the system account, the user is notified that an "Interactive Service Dialogue Detection".  By using StartasUser we overcame that.


          EXEC9010=%DEST%\LOCALSCH.EXE /exe="%DEST%\startasuser.exe" /cmd="%DEST%\Antivirus\LDAV.exe /scancomputer /showui" /taskid=2010 /freq=4200 /tod="12|13" /dow="4|4"

          • 2. Re: Can startasuser.exe be used in localsch?

            Thanks for the information.  Knowing that startasuser.exe can be scheduled via localsch.exe really helps.


            My scheduled tasks can now access network resources.  I may have to tweak these, but so far I have successfully used the three commands below.  I'm not to the point of burning these into localsch yet.  I'm just checking out the end result at this point.  I'm able to copy files using UNC paths from a script initiated via localsch.


            Windowed -

            localsch.exe /exe="%ProgramFiles%\LANDesk\LDClient\startasuser.exe" /cmd="%ComSpec% /C C:\Utility\mycmd.cmd"


            Minimized -

            localsch.exe /exe="%ProgramFiles%\LANDesk\LDClient\startasuser.exe" /cmd="%ComSpec% /C Start """"mycmd""" /min %ComSpec% /C C:\Utility\mycmd.cmd"


            Hidden -

            localsch.exe /exe="%ProgramFiles%\LANDesk\LDClient\startasuser.exe" /cmd="///silent %ComSpec% /C C:\Utility\mycmd.cmd"

            • 3. Re: Can startasuser.exe be used in localsch?
              Tom Farrugia SupportEmployee

              That's great.  But remember, even scheduled tasks run as the system account can have access to network resources providing they are on the same domain as the resource server and you have enabled at least Read access to "Domain Computers" on the share you want to acess.

              • 4. Re: Can startasuser.exe be used in localsch?
                ecoidan Specialist

                If your going to user the STARTASUSER.EXE in the localsch then you should also add the /USER switch. This will make sure you have an active desktop with someone logged in on the system so STARTASUSER.EXE will work..


                Otherwise if no one is logged into the system and the localscheduler kicks off a STARTASUSER command, who would it run as since no one is logged in?