viewpoint-particle

Author Topic: Running Code With Status Box Displays  (Read 596 times)

geauga

  • Newbie
  • *
  • Posts: 22
Running Code With Status Box Displays
« on: April 20, 2017, 05:48:42 am »
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
 
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
 


td

  • Tech Support
  • *****
  • Posts: 2185
    • WinBatch
Re: Running Code With Status Box Displays
« Reply #1 on: April 20, 2017, 06:39:04 am »
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.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


geauga

  • Newbie
  • *
  • Posts: 22
Re: Running Code With Status Box Displays
« Reply #2 on: April 20, 2017, 07:00:33 am »
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

  • Tech Support
  • *****
  • Posts: 2185
    • WinBatch
Re: Running Code With Status Box Displays
« Reply #3 on: April 20, 2017, 07:32:36 am »
Please read the Tech Database article.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


geauga

  • Newbie
  • *
  • Posts: 22
Re: Running Code With Status Box Displays
« Reply #4 on: April 20, 2017, 09:38:57 am »
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

  • Tech Support
  • *****
  • Posts: 2185
    • WinBatch
Re: Running Code With Status Box Displays
« Reply #5 on: April 20, 2017, 01:15:11 pm »
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. 
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates