Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 03-03-2020, 02:25 PM
thebick thebick is online now
Registered User
 
Join Date: 03-02-2020
Posts: 1
Need to restart build elevated with all arguments

I am trying to automate a Visual Build Pro process (that I inherited) that must run elevated, and has some VBScript to restart it as elevated if it determines that it's not.

If I double-click on the .bld file, I get two VBP windows: the first is unelevated that promptly completes; the second is elevated, so clicking the green arrow sends everything off fine. I don't get a dialog asking me if I want to allow this program to run or make modifications to the system.
If I right-click > "Run As Administrator", I get just the one elevated window, and all is well.
OS: Windows 10

I have a command-line script with needed arguments that works if I run it in a "Run as Administrator" Command or PowerShell window.
But when I run the script from the command line (PowerShell or Command) or from Jenkins via PowerShell or batch, I get two problems:

1. "Error building application: Build already in progress"
I think this is because of the attempted restart as elevated, but the original command should have completed, so no build should have been in progress. I have looked all over this site and the web trying to find out what causes this, and have found nothing.

2. The VBScript uses the following to restart as elevated ("IsElevated" is a macro that the script uses):
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "C:\Program Files\VisBuildPro9\VisBuildPro", "IsElevated=True """ + mybuildfile.bld + """", "runas", 1

The result seems to be that an elevated GUI is launched, and without the other arguments that I had in the command line, including macro definitions. I would like the command line to be re-launched elevated. Or is there a way that I can force the command line to run elevated (remember, I want to do this in Jenkins)?

My account has some administrator privileges. E.g., in Task Manager, I can modify the Logon properties of services. And whether running VBP or Task Manager from the GUI, I don't get the dialog asking me for permission to run the process.
But for some reason, it's not "elevated". Is there a simple command-line check to see whether my account is elevated?

I also note in the same VBScript part of the .bld after the above (the Property keys should not have an embedded space, but Preview puts a space in there ):
'clear out the current project and set it up to log an informational message
Application.Project.New(False)
Application.Project.Steps(0).Add "Log Message", 0
Application.Project.Steps(0).Item(0).Name = mybuild.bld + " was restarted elevated"
Application.Project.Steps(0).Item(0).Property("pau sebefore") = "3"
Application.Project.Steps(0).Item(0).Property("Mes sage") = _
"Build was started unelevated. Re-opened elevated" + vbCrlf + _
"This window can be closed at any time"

Application.Builder.Start -1, -1, 0, ' Starting the build with a step designed to log a message is the only way I could find to output a message about why the build opened a second window.

I have tried to find anything about "pausebefore", but no luck. I find that if I increase the value, it only delays the message appearing in the unelevated GUI.

Note: for security reasons, that system is not connected to the Internet, and installing a program goes through a lot of hurdles.
Reply With Quote
  #2  
Old 03-03-2020, 10:40 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
See https://www.kinook.com/Forum/showthread.php?t=2258

The pausebefore property corresponds with the Pause x seconds before... option on the General tab of the Step Properties dialog.

https://kinook.com/VisBuildPro/Manual/buildrules.htm
Reply With Quote
Reply

Tags
command , elevated , re-launch


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 08:10 AM.


Copyright © 1999-2023 Kinook Software, Inc.