Running Code With Status Box Displays

Started by geauga, April 20, 2017, 05:48:42 AM

Previous topic - Next topic

geauga

I am trying to run code while a status box displays.  I open a box and then try running my code and then I shut the box.  The box functions work fine but the RunWithLogon command does not run.  To confirm that the RunWithLogin command was not being ingnored I commented out the runas_pass variable and the job threw an error.  What am I doing wrong?

Code (winbatch) Select

DebugTrace(@on,"C:\Data\box_display.txt")


Title = "Loading Client Pack"
Main = " ":@CR:"Running Client Pack Install"
runas_user = "********"
runas_pass = "********"
runas_domain = "********"
BoxOpen(Title,Main)

param2 = "test.dat"
client_pack_name = StrCat("c:\Data\Source\", param2)
Install_Params = StrCat("c:\Data\Source\InstallMSP.exe /s /icp " ,client_pack_name, " /p REBOOT=ReallySuppress SKIPDEPLOYMENTCHECK=1")

strCmd = Environment("COMSPEC")
RunWithLogon ("c:\Data\Source\InstallMSP.vbs",  Install_Params, "", @NORMAL, @WAIT, runas_user, runas_domain, runas_pass,1)
BoxShut()
Code (winbatch) Select



td

You could be doing one or more of many things wrong but you need to specify your version of Windows on its UAC settings to narrow things down a bit. For starters though you might want to read the following Tech Database article:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/UAC+RunWithLogon~and~UAC.txt

And while not related to your problem, you have the line

strCmd = Environment("COMSPEC")

which does nothing other than waste a few CPU cycles.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

geauga

I should add that that the RunWithLogon code has been working for years.  I was just trying to add boxes that continued to display when codes runs in the background.  I am on Windows 7 Pro.

==============================
Thu 4/20/2017 8:38:46 AM
WinBatch 32 2016B
WIL DLL 6.16bpb
H:\Winbatch\box_display.wbt
Windows platform: NT, version: 6.1, build: 7601 (Service Pack 1)
ErrorMode: @CANCEL
Valid Code Signature: Yes
UAC Manifest Settings: level="highestAvailable" uiAccess="true"
UAC Elevation Level: Standard User or Disabled

td

"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

geauga

I have read the RunWithLogon/UAC documentation and do not see what I am doing wrong.  My code has worked for years.  UAC is not enabled on our PCs.  It is only when I add a BoxOpen and BoxShut around the code that the RunWithLogin fails to run.  I have taken your advice and remove the strCmd = Environment("COMSPEC") line.

td

There is no way of knowing whether or not UAC is enabled based on the information given (and no the cut and paste from a trace file doesn't indicate the UAC state) so that is the reason for the suggestion to read the article.   

There is no known way for (or instances of over the last 15 years or so)  a Box function affecting RunWithLogon.   You likely have something else going on that you are either not aware of or not mentioning.  It is possible that the vb script you are starting or one if its child processes is being affected by a shown window in a parent process but that is a problem with your vb script or its child process. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade