2

Here is my question. My company is taking our Help Desk back inside our company from an MSP and we need to be able to display a popup HTA message multiple times a day for HR and LP.

I know everyone will cringe at this but we have about 1500 Windows 7 Pro computers NOT domain joined (not my choice). We are utilizing LogMeIn Central Premiere which I can deploy scripts with. It's the same user name on each computer and they are not members of the admin group, just User group. I would like to be able to have the message pop at 10am, 1pm and 4pm but can't seem to get the HTA file to display on the computer running through a batch file.

For testing in my office I ran psexec from my machine to my test machine and it opens fine over the command line (hta file is saved locally on each machine). It appears to have to do with System 0 and I hope that someone out there may have tackled this in the past.

I have also been trying to create a scheduled task to call the hta file but once again the file does not show running when the user is logged in.

Any help would be appreciated.

6
  • Totally not going to help, but...1500 non-domain joined PCs? The cost of two high-end DCs would literally be less than $2.50 USD per machine. Oct 25 '17 at 23:57
  • I completely agree but lost out with that war. I have about 250 machines in a domain from the company I worked for that was purchased by the larger company and they are forcing me to change over to LogMeIn and no DC. I have been fighting this for 8 months now and was told it's not happening and make this work.
    – Scott J
    Oct 25 '17 at 23:59
  • I'm speechless. But I know these types. They learn best by having the house burn down. Oct 26 '17 at 0:10
  • In other news, have you scheduled your hta task to run in the context of the user account that needs to see the message? Oct 26 '17 at 0:11
  • These circumstances sound horrible. You have bigger issues in your environment than solving this problem. Sounds like the batch works when you run it locally but not remotely with psexec. Can you get any scripts to run remotely with success? If you can, and it's just your HTA launch script failing, add logging to the .bat/.ps1 to determine where the script is failing, making sure that it gets called at all.
    – root
    Oct 26 '17 at 14:30
0

I've done something similar before with displaying HTA messages on Windows computers with a batch script so I figured I'd share my example with you and you can adjust for you needs in case it helps with your problem.

Essentially this builds a dynamic HTA file and then executes it with wscript

Batch Script Example

The HTA title and three body lines are variables setup up top in this batch script example. The timer is used for the number of seconds before the message auto-closes.

You should be able to use this logic as a starting point and adjust accordingly for your needs. You can put your HTA file logic in the batch, copy it and then call or whatever I suppose.

IF NOT DEFINED MINIMIZED SET MINIMIZED=1 && START "" /MIN "%~dpnx0" %* && EXIT
@ECHO OFF 

SET MsgTitle=Hey! Here is a Title!
SET MsgLine1=Hey! Here is a message!
SET MsgLine2=Message Line Two.
SET MsgLine3=Message Line Three.
::: -- Set the number in seconds you want the window to close
SET CloseTimer=5
SET TmpHTAFile=%tmp%\tmp.hta
SET TmpVBSFile=%tmp%\tmp.vbs
IF EXIST "%TmpHTAFile%" DEL /Q /F "%TmpHTAFile%"
IF EXIST "%TmpVBSFile%" DEL /Q /F "%TmpVBSFile%"

ECHO ^<html^>                                                       >> "%TmpHTAFile%"
ECHO ^<head^>                                                       >> "%TmpHTAFile%"
ECHO ^<hta:application                                              >> "%TmpHTAFile%"
ECHO APPLICATIONNAME = "Message Alert"                              >> "%TmpHTAFile%"
ECHO ID = "Message Alert"                                           >> "%TmpHTAFile%"
ECHO BORDERSTYLE = "Normal"                                         >> "%TmpHTAFile%"
ECHO CAPTION = "No"                                                 >> "%TmpHTAFile%"
ECHO CONTEXTMENU = "No"                                             >> "%TmpHTAFile%"
ECHO INNERBORDER = "No"                                             >> "%TmpHTAFile%"
ECHO MAXIMIZEBUTTON = "No"                                          >> "%TmpHTAFile%"
ECHO MINIMIZEBUTTON = "No"                                          >> "%TmpHTAFile%"
ECHO NAVIGABLE = "No"                                               >> "%TmpHTAFile%"
ECHO SCROLL = "No"                                                  >> "%TmpHTAFile%"
ECHO SCROLLFLAT = "No"                                              >> "%TmpHTAFile%"
ECHO SELECTION = "No"                                               >> "%TmpHTAFile%"
ECHO SHOWINTASKBAR = "No"                                           >> "%TmpHTAFile%"
ECHO SINGLEINSTANCE = "Yes"                                         >> "%TmpHTAFile%"
ECHO SYSMENU = "No"/^> ^<STYLE^>                                    >> "%TmpHTAFile%"
ECHO html, body {                                                   >> "%TmpHTAFile%"
ECHO background color: #000000                                      >> "%TmpHTAFile%"
ECHO  font-size: 90%;                                               >> "%TmpHTAFile%"
ECHO  line-height: 2.1em;                                           >> "%TmpHTAFile%"
ECHO  margin: 10;                                                   >> "%TmpHTAFile%"
ECHO  padding: 0;                                                   >> "%TmpHTAFile%"
ECHO }                                                              >> "%TmpHTAFile%"
ECHO h1 {font-family: Arial;                                        >> "%TmpHTAFile%"
ECHO  color: #FF0000;                                               >> "%TmpHTAFile%"
ECHO  font-size: 3em;                                               >> "%TmpHTAFile%"
ECHO  text-align: center;                                           >> "%TmpHTAFile%"
ECHO }                                                              >> "%TmpHTAFile%"
ECHO h2 {font-family: Arial;                                        >> "%TmpHTAFile%"
ECHO  color: #ffffff;                                               >> "%TmpHTAFile%"
ECHO  font-size: 1.5em;                                             >> "%TmpHTAFile%"
ECHO  text-align: left;                                             >> "%TmpHTAFile%"
ECHO }                                                              >> "%TmpHTAFile%"
ECHO h3                                                             >> "%TmpHTAFile%"
ECHO {font-family: Arial;                                           >> "%TmpHTAFile%"
ECHO  color: #666666;                                               >> "%TmpHTAFile%"
ECHO  font-size: 1em;                                               >> "%TmpHTAFile%"
ECHO  text-align: center;                                           >> "%TmpHTAFile%"
ECHO }                                                              >> "%TmpHTAFile%"
ECHO ^</STYLE^> ^<script type='text/vbscript'^> Sub Window_onload() >> "%TmpHTAFile%"
ECHO me.ResizeTo 500,280                                            >> "%TmpHTAFile%"
ECHO me.MoveTo Screen.Width /2 - 300,Screen.Height / 2 - 300        >> "%TmpHTAFile%"
ECHO me.SetTimeout "Me.Close()",%CloseTimer%000                     >> "%TmpHTAFile%"
ECHO End Sub                                                        >> "%TmpHTAFile%"
ECHO ^</script^>                                                    >> "%TmpHTAFile%"
ECHO ^</head^>                                                      >> "%TmpHTAFile%"
ECHO ^<body scroll="no"^>                                           >> "%TmpHTAFile%"
ECHO ^<br^>                                                         >> "%TmpHTAFile%"
ECHO ^<h1^>%MsgTitle%^</h1^>                                        >> "%TmpHTAFile%"
ECHO ^<h2^>%MsgLine1%^<br^>                                         >> "%TmpHTAFile%"
ECHO %MsgLine2%^<br^>                                               >> "%TmpHTAFile%"
ECHO %MsgLine3%^</h2^>                                              >> "%TmpHTAFile%"
ECHO ^<h3^>close in %CloseTimer% seconds^</h3^>                     >> "%TmpHTAFile%"
ECHO ^<script type="text/javascript"^>                              >> "%TmpHTAFile%"
ECHO ^</script^>                                                    >> "%TmpHTAFile%"
ECHO ^</body^>                                                      >> "%TmpHTAFile%"
ECHO ^</html^>                                                      >> "%TmpHTAFile%"

ECHO Set objShell = Wscript.CreateObject("Wscript.Shell")           >> "%TmpVBSFile%"
ECHO objShell.Run ("%TmpHTAFile%")                                  >> "%TmpVBSFile%"
wscript "%TmpVBSFile%"
DEL /Q /F "%TmpVBSFile%"

Source Idea


Further Resources

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.