From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Execute Command - cmd.exe Command with Elevation (Privileges)

Hi,

 

So I am trying to programmatically change the IP address and subnet mask of a USB to ethernet adapter for a test system. I have developed a string for the command that I have tested using cmd.exe to prove that it works. The structure of the command is: runas /netonly /user:admin netsh interface ip set address name="Ethernet" static ###.###.###.### ###.###.#.# where ###.###.###.### is the IP address I want to set and ###.###.#.# is the subnet mask. 

 

Is there way to send this command with elevation or administrative rights through TestStand? I either have to be able to send the admin password in the same cmd window (Standard Output of Execute Command returns string telling me to enter password for admin) via TestStand or send the original command with rights. I have looked for hours for a solution, but have had no luck.

 

Thanks

0 Kudos
Message 1 of 3
(806 Views)

If you run TestStand as Administrator then whatever TS calls will run with admin privileges.

 

As per my understanding, a lower privilege application cannot execute another application with a higher privilege.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 3
(786 Views)

Thanks for the reply, however, in my case, this will not work because the person who will operate the TestStand program will no be someone with higher privileges.

0 Kudos
Message 3 of 3
(764 Views)