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.

Scott J
  • 21
  • 1
  • 3
  • 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. – I say Reinstate Monica 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. – I say Reinstate Monica Oct 26 '17 at 00: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? – I say Reinstate Monica Oct 26 '17 at 00: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
  • You want to send popup **messages**, or popup **reminders**? Kind of sounds like the latter... You probably have some kind of mail & calendar system. Send a calendar event to everyone that pops at those times. – Clayton Oct 27 '17 at 15:41

1 Answers1

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

Vomit IT - Chunky Mess Style
  • 40,038
  • 27
  • 84
  • 117
  • Consider building such a script and creating and scheduling the batch script to run at the scheduled times with PSEXEC with task scheduler from command line one time then it'll execute locally... see https://superuser.com/questions/1214736/windows-10-scheduled-tasks-with-workstation-lock-unlock-not-being-triggered/1217125#1217125 for tips with scheduling a batch script and troubleshooting, etc. – Vomit IT - Chunky Mess Style Oct 29 '17 at 21:33
  • See here about creating scheduled tasks via command line. . . https://www.windows-commandline.com/schedule-tasks-command-line/ for some exampes – Vomit IT - Chunky Mess Style Oct 29 '17 at 21:41