command CMD

Ask general questions here.
User avatar
Julien Diot
Posts: 50
Joined: Wed Feb 20, 2019 4:25 pm
Location: Amiens (FR)

command CMD

Post by Julien Diot » Fri Jul 03, 2020 8:17 am

Hello,

I encounter a problem, I launch "Ranorex Studio" as administrator because I need to activate the "Debug" mode.
When, by script, I run "cmd" via System.Diagnostics.Process.Start to mount a network drive (useful for the application to test), this one launches as administrator and my drive is mounted but not visible in my drive list.

If I run "cmd" as administrator, the "net use" returns my drive.
If I run "cmd" without privilege, the "net use" does not return my drive.

How can I launch "cmd" without privileges when "Ranorex studio" is launched as administrator and my session account is an administrator account?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: command CMD

Post by odklizec » Fri Jul 03, 2020 9:14 am

Hi,

I'm slightly confused here? :) If Ranorex is started as admin, then any command launched from it (including CMD), should by started with admin privileges as well. But then you mention this...
If I run "cmd" without privilege, the "net use" does not return my drive.
But then you asking how to launch CMD as non-admin?...
How can I launch "cmd" without privileges
So when exactly CMD works as expected? With or without admin privileges?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Julien Diot
Posts: 50
Joined: Wed Feb 20, 2019 4:25 pm
Location: Amiens (FR)

Re: command CMD

Post by Julien Diot » Fri Jul 03, 2020 9:37 am

Thank you for your answer.

The CMD command works correctly without administrator privileges.

If I run "cmd" as administrator off ranorex, the "net use" returns my drive create in ranorex (with privileges admin) but this drive is not visible in local drivers.
If I run "cmd" without privilege off ranorex, the "net use" does not return my drive create in ranorex (with privileges admin).

For this to work, I'd have to run the "net use" command by running CMD without admin privileges in ranorex.

User avatar
Julien Diot
Posts: 50
Joined: Wed Feb 20, 2019 4:25 pm
Location: Amiens (FR)

Re: command CMD

Post by Julien Diot » Fri Jul 03, 2020 9:50 am

Off ranorex,
If I do a net use x: \\ShareFolder" by running "CMD" with admin privileges, my drive is created but not visible in local drives, the mapping is not accessible. Not OK.

If I do a "net use x: \\ShareFolder" by running "CMD" without admin privileges, my drive is created and visible in local drives, the mapping is accessible. Ok.

So I would like to be able to run "CMD" without admin privileges even if "Ranorex" is run as admin.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6180
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: command CMD

Post by odklizec » Fri Jul 03, 2020 9:59 am

I see. Well, I'm afraid, there is no an easy and one step solution for this. Check for example this discussion:
https://stackoverflow.com/questions/117 ... ld-process
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Julien Diot
Posts: 50
Joined: Wed Feb 20, 2019 4:25 pm
Location: Amiens (FR)

Re: command CMD

Post by Julien Diot » Fri Jul 03, 2020 10:28 am

Thank you. I'm gonna go read this.