/build/static/layout/Breadcrumb_cap_w.png

Need help running a batch script from an elevated command prompt on the K1000.

I am trying to run a batch script that has to be run from an elevated command prompt. I know I have done this before, but I can't seem to get it to work now. It is set up as an online kscript with Run as User checked and the administrator credentials are provided. When I run the script, it does not complete. If I go into the dependency directory and right click the batch file and hit run as administrator, it runs fine.


4 Comments   [ + ] Show comments
  • are you using the runas command?

    Runas (place username and password) (xxx.bat) - SMal.tmcc 10 years ago
    • No, I thought that if I used the run as user in the KScript and put in administrator credentials, that it would elevate it. - WGM_Jeff 10 years ago
      • Can you do a screen shot of the script?
        Also if you can post your batch, they may be a more direct method to calling what you are trying to do.

        Note: I have had to switch to calling cmd.exe as the program to run with 3.5 and put the batch file in the parameters with some things.

        you would Launch c:\windows\system32\cmd.exe with params /c my.bat - SMal.tmcc 10 years ago
  • I added a screen shot that I am working from right now. - WGM_Jeff 10 years ago
  • I will try using the launch and see what happens. - WGM_Jeff 10 years ago
  • Still a no go from KACE, but like I said, if I run any of these options locally on the computer,it works. - WGM_Jeff 10 years ago

Answers (3)

Answer Summary:
Posted by: SMal.tmcc 10 years ago
Red Belt
0

You can also add psexec as a dependancy and run that way

psexec -u user -p password batfile.bat

Posted by: SMal.tmcc 10 years ago
Red Belt
0

try this

 


Comments:
  • When I tried that, the script failed with the message that it could not find the file specified. - WGM_Jeff 10 years ago
Posted by: WGM_Jeff 10 years ago
4th Degree Black Belt
0

OK, no matter what I tried, I could not get it to run. It seems that when KACE calls the script it uses the command prompt that is in SYSWOW64 instead of System32. The file I need to call was in the system32 folder. 

I added bcdedit as a dependency to the script and it is working now.


Comments:
  • good to hear

    I have been trying to use the steps I would put in a batch file as lines in scripts and have had lots more success. I usually use the dos paths to call the exe's instead of a variable for that reason. a couple of exe's have both 32 and 64 copies in the OS and if you do not call the proper version things do not happen as they should sometimes. the fall back is sometimes I have to create a 32 and 64 bit script to do the same thing. - SMal.tmcc 10 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ