For security reasons, my company is changing access to a windows application to allow access only if "Run as Administrator" is selected. If launched independently of my robotics automation solution (from the public desktop icon), the shortcut itself prompts the user to agree to run as administrator and then runs the .bat file to load the application. Currently my adapter runs straight to the .bat file, but I need it to run thru the new shortcut and let the shortcut launch the application. How can I accomplish this in the adapter? If I set the path to the shortcut.lnk file, my StartMethod changes from "Start" to StartandWait" and then I get a message that the "TargetPath must contain a value for StartMethod StartandWait." If I set the TargetPath to either the shortcut folder or the actual application folder (where the .bat file is), then I get a message "An error occurred while setting up shared memory with the service 'OpenSpan Services'. Verify that the service is running". Please advise.
***Edited by Moderator Marissa to update categories***
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
Hmm... When I point the path to the link, it automatically puts the location path of the shortcut and therefore bypassing the "Run as Administrator" that the shortcut is supposed to do. I was able to get around this by creating a batch file that started the shortcut link directly. Then I used the StartMethod StartAndWait to wait for the process that I am trying to inject/automate. I would create a batch file that starts the shortcut link and use this as the process to start with Path and the main application as the TargetPath. This might not be the batch file you're referring to because it sounds like the batch starts another process... it will be that final process that's started.
Keep in mind... Runtime needs to run at the same level as the application... if the application is running as Admin then Runtime also needs to run as Admin... and if this is the case.. You might not even need to use the shortcut because all processes started from Runtime will be elevated to Admin anyways! Then you can just start the process as you did before...
Posted: 5 years ago
Posted: 9 Aug 2017 13:07 EDT
Vicki Baluch (VickiB36)
Cross Functional Business Lead