Run as Admin Tools

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
Jack
Posts: 4
Joined: Tue Jul 09, 2019 2:06 pm

Run as Admin Tools

Post by Jack » Tue Jul 09, 2019 2:10 pm

Hello,
With my recent move to win10, one of my tools I have Zeus configured for now requires running as admin. The tool is a batch file. It no longer works from Zeus. It works from a cmd window if I right click and select run as admin. I tried checking the zeus properties and setting run as admin. I get prompted when invoking Zeus, but the tool still doesn't work. Is there a way to do this?
Thanks!
Jack

jussij
Site Admin
Posts: 2442
Joined: Fri Aug 13, 2004 5:10 pm

Re: Run as Admin Tools

Post by jussij » Wed Jul 10, 2019 12:02 am

Hi Jack,
It works from a cmd window if I right click and select run as admin.
Why this works is because when you right click and select run as admin you are running the cmd prompt with admin rights and that means when you then run your cmd file it also runs with those same admin rights.

However, when you start Zeus it is running with normal rights and that means when Zeus runs the cmd file it can only run that file with those same normal rights.

The two options that can fix this are:

1. Start Zeus with admin rights.
2. Elevated the user rights when cmd file is run.

IMPORTANT: While option 1 would work it is also a very bad idea so don't do this :!:

But you could run option as a one off test and you should see the batch file will also run fine if Zeus had admin rights.

So the only real option is the second option.

To achieve this you could try changing the Zeus configuration for your cmd to be something like this:

Code: Select all

runas /user:administrator your_batch.cmd
This change should mean the cmd will get run with elevate the rights when it is run from inside Zeus.

More info about that Microsoft utility can be found here: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc771525(v%3Dws.11)

Alternatively you could do something like this: https://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator

Cheers Jussi

Jack
Posts: 4
Joined: Tue Jul 09, 2019 2:06 pm

Re: Run as Admin Tools

Post by Jack » Wed Jul 10, 2019 1:06 pm

Hi Jussij,

Thanks for your reply. Your suggestions addressed the "Run as Admin" issue, only for me to hit another issue. All batch files I use as Zeus tools work correctly except one. This one batch file works when not invoked from Zeus. I can successful run it from a cmd box, from File Explorer, and even from the file open dialog in Microsoft Word. However, it does not run from any method in Zeus including as a configured Tool, DOS Command Line, DOS Shell created from Zeus, or from the Zeus File Open Dialog.

The batch file has 2 lines of code
set ON_TIME_PATH="C:\Program Files (x86)\On Time RTOS-32 6.0"
"C:\Program Files (x86)\On Time RTOS-32 6.0\bin\dbgshell.exe" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Devenv.exe" debug.exe


dbgshell.exe is a remote debugger that invokes visual studio. This has worked under Zeus for years when I was using win7. I am now using win10. I switched to win10 a month ago. It worked for a couple weeks and now has stopped working.

I am using Zeus version 3.97y-Beta3. If you think there is a chance that updating to the newest version will help, I will try that. I assume this means a licence upgrade.

Any thoughts?
Thanks Again!

jussij
Site Admin
Posts: 2442
Joined: Fri Aug 13, 2004 5:10 pm

Re: Run as Admin Tools

Post by jussij » Wed Jul 10, 2019 1:29 pm

Using the Options, Editor Options menu and in the General panel there is an Debug tools macros and executables option.

If you turn on that option you will see what command line Zeus is trying to run.

If you then use the Tools, Dos Shell menu you will get to a command prompt.

In that prompt run these same commands and see if they work.

My guess is if the commands being run are correct, then they will also not run in that shell.

And if that is the case then it means the issue is probably related to some sort of missing environment variable or a missing system wide configuration.

Cheers Jussi

Jack
Posts: 4
Joined: Tue Jul 09, 2019 2:06 pm

Re: Run as Admin Tools

Post by Jack » Wed Jul 10, 2019 4:09 pm

Hi Jussi,

I turned on the debugging option, but I don't know where to look for the output. I changed the tool config from Run Hidden to Run Normal, but there was no Zeus output there to see. I looked in the Zeus log an saw nothing useful.

I then tried a Zeus command box ( menu Tools-> Menu item DOS Shell). The batch file does NOT work there but in works in a cmd box started from Window's Start Menu. Unless you have any additional thoughts, I'm about ready to give up on this great Zeus feature I have been using for years and just setup a set of shortcuts I can access from the Start Menu.

Thanks,
Jack

jussij
Site Admin
Posts: 2442
Joined: Fri Aug 13, 2004 5:10 pm

Re: Run as Admin Tools

Post by jussij » Wed Jul 10, 2019 11:46 pm

but I don't know where to look for the output.
You find this under the Macros, Macro/Debug Output menu.

The batch file does NOT work there but in works in a cmd box started from Window's Start Menu.
That is what I would have expected to see.

As I said before this means the issue is probably related to some sort of missing environment variable or a missing system wide configuration.

What I would suggest doing is continuing to try and run the batch file in the Zeus DOS Shell and trying to figure out what environment change needed to get the batch file to run.

Also if you have an

Code: Select all

@echo off
statements in the batch file your should

Code: Select all

rem @echo off
them out as that will help you figure out which line of the batch file is failing.

You can also compare the environments by running this command in the good cmd prompt:

Code: Select all

set > env_good.txt
and running this command in the bad cmd prompt:

Code: Select all

set > env_bad.txt
Then compare the two files produced.

Now Zeus will be adding things to the environment, but nothing should be missing and if details are missing that could be the cause of the issue.

Now my guess is the Zeus changes to the PATH might have caused the problem.

You can test this theory by running this command:

Code: Select all

set PATH=<<< Use the path details from the good cmd.exe here
in the bad cmd and then seeing if the batch file runs.

And if that does work all you need to do is create a second batch file that looks like this:

Code: Select all

@echo off
set PATH=<<< Use the path details from the good cmd.exe here
call your_batch_file.cmd
and then use that batch file inside Zeus.

Cheers Jussi

Jack
Posts: 4
Joined: Tue Jul 09, 2019 2:06 pm

Re: Run as Admin Tools

Post by Jack » Thu Jul 11, 2019 2:03 pm

Hi Jussi,

There is no debug output in the Macros->macro_debug output. I wouldn't expect it because the programs in the batch file are being invoked. Visual studio is hanging up. I see it running with task manager.

There are only a few environment differences.
CommonProgramFiles
Zeus Cmd Box: C:\Program Files (x86)\Common Files
Win Cmd Box: C:\Program Files\Common Files

ProgramFIles
Zeus Cmd Box: C:\Program Files (x86)
Win Cmd Box: C:\Program Files

PROCESSOR_ARCHITECTURE
Zeus Cmd Box: x86
Win Cmd Box: AMD64

PROCESSOR_ARCHITEW6432
Zeus Cmd Box: AMD64
Win Cmd Box: not present

Zeus also adds many additional paths, but all the paths in the windows cmd box are present in the Zeus command box. Zeus also adds a PYTHONPATH variable.

From the Zeus cmd box, I changed all the environment variables that were different to be the same as the windows cmd box. It still doesn't work

So At this point, I think the issue is not Zeus. Since the feature worked for the 1st month I have this computer and suddenly stopped working, I am assuming that some windows policy has been changed by my IT department. I'll pursue it with them. If I discover they can actually remotely break this feature, I'll post something here FYI.

Thanks for the great support!
Jack

jussij
Site Admin
Posts: 2442
Joined: Fri Aug 13, 2004 5:10 pm

Re: Run as Admin Tools

Post by jussij » Thu Jul 11, 2019 11:58 pm

Hi Jack,
Thanks for the great support!
Always happy to try and help :)

This difference might be causing some problems:
Zeus Cmd Box: C:\Program Files (x86)\Common Files
Win Cmd Box: C:\Program Files\Common Files
The path with the (x86) represents a 32 bit appliction where as the other one is 64 bit.

Because Zeus is a 32 bit application, it will start a 32 cmd.exe but since the OS is 64 bit it starts a 64 bit command prompt.

Now the problem is Windows does all of this automatically meaning any 32 pit application running cmd.exe will always get a 32 bit prompt.

So if your batch file does actually need a 64 bit environment then that will be a problem.

However, I did a Google search and it turns out you can work around this using a symbolic link.

Here are the details: open-64-bit-command-prompt-in-32-bit-command-prompt-to-execute-64-bit-command-prompt-through

So you could try creating a symbolic link to the 64 bit cmd.exe and then changing the Zeus configuration to run that batch file using the symbolic link.

Cheers Jussi

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 2 guests