Reminders
Question

VBScript for Windows Pop-Up (2003/XP, 2008/7)

2 years ago
OfflinePhoto of Norman F
Norman F

Hi,

I'm looking for a solution for the following scenario:

let's say we've got a member of the Help Desk responsible for part of our network environment. The WUG server is not able to send emails, SMS or anything like that in the event of a down device, though we certainly want to make this member aware of the issue.

Now the IT Dept. comes up with the idea to use Windows Pop-Ups (e.g. as a VBScript Action) to do this. In detail

  • Device A (not that important) goes down
  • a Script Action brings up a pop-up on the screen of the WUG server (the Help Desk member is connected to the WUG server via a RDP session, so no need to open that pop-up on a remote system, this could be a "nice-to-have" feature)
  • the Help Desk member knows that he can take a look at this device later that day, he leaves it open as a reminder and won't close it
  • Device B (important) goes down
  • the same Script Action brings up another pop-up on the screen of the WUG server
  • the Help Desk member takes care of this problem immediately and closes the pop-up for Device B afterwards
  • later that day he also takes care of Device A and closes the pop-up

Now there are two problems I encounter using the standard WhatsUp Gold tools:

  1. if it's a Windows Server 2008 system (which it actually is), the built-in "WinPopup Action" won't fit these needs
  2. even if not (i.e. it's a Windows 2003 or XP system) that same action is not capable of creating multiple pop-ups (no new alert/pop-up as long as the last one generated hasn't been closed)

Next, I tried to build a Script Action that represents the upper scenario. I need to say, that I'm really far from being a programmer and do not have any experiences in VBScript or JScript - so please don't be to harsh about the following code ;-)

Solution A (with <var>.Popup)

' WhatsUp Event Viewer Log'

'Context.LogMessage "Checking Address = " & Context.GetProperty("Address")
'Context.LogMessage "Checking Display Name = " & Context.GetProperty("DisplayName")


' GET the device IP Address '

sDeviceAddr = "192.168.0.50"
'sDeviceAddr = Context.GetProperty("Address")
'sDeviceName = Context.GetProperty("DisplayName")


' Windows Pop-Up  * DECLARATION * '

Dim objWSH
Dim objSystemVariables

Dim shWindow
Dim sWindowTitle, sWindowBody
Dim iMessageTime, iButtonIcon

SET shWindow = CreateObject("WScript.Shell")

sWindowTitle = "WhatsUp Gold DOWN Alert"
sWindowBody = "The following device  is DOWN:" & chr(13) & Now & " -- DeviceDisplayName -- " & sDeviceAddr
iMessageTime = 0
iButtonIcon = 0 + 48


' Windows Pop-Up  * INVOCATION * '
' Part A: pop-up body
' Part B: display time of the message (if 0, wait until user interaction, e.g. "OK" button pressed)
' Part C: pop-up header
' Part D: button / icon type

shWindow.Popup sWindowBody, iMessageTime, sWindowTitle, iButtonIcon

--- END ---

As you can see, I first tried to run the script with static values (IP Address), just to make sure the script and so the pop-up runs fine. The script, run as a *.vbs file, works and brings up a pop-up just the way it should. It also does that, when testing it as an Active Script Action with the WUG Admin Console.

But when I apply that Active Script Action to a device (either as a global action or on a "per active monitor" basis), nothing happens - at least no pop-up. Going to "Tools" - "Running actions..." I can see the action with that status "running".

I've also done a script using MsgBox instead of .Popup, but that one fails testing it with the WUG Admin Console ("Permission denied...").

Solution B (with MsgBox)

' WhatsUp Event Viewer Log '

'Context.LogMessage "Checking Address = " & Context.GetProperty("Address")
'Context.LogMessage "Checking Display Name = " & Context.GetProperty("DisplayName")


' GET the device IP Address '

sDeviceAddr = "192.168.0.50"
'sDeviceAddr = Context.GetProperty("Address")
'sDeviceName = Context.GetProperty("DisplayName")


' Windows Pop-Up  * DECLARATION * '

Dim objWSH
Dim objSystemVariables

Dim shWindow
Dim sWindowTitle, sWindowBody
Dim iButtonIcon

SET shWindow = CreateObject("WScript.Shell")

sWindowTitle = "WhatsUp Gold DOWN Alert"
sWindowBody = "The following device  is DOWN:" & chr(13) & Now & " -- DeviceDisplayName -- " & sDeviceAddr
iButtonIcon = 0 + 48


' Windows Pop-Up  * INVOCATION * '
' Part A: pop-up body
' Part B: button / icon type
' Part C: pop-up header

shWindow = MsgBox(sWindowBody, iButtonIcon, sWindowTitle)

--- END ---

So, what am I missing? I would be very grateful for any ideas or advice on how to get this to work.

Thanks a lot,
Norman

Answered

0 Answers:

14 Replies

OfflinePhoto of Paul Byers Paul Byers said 2 years ago

Why not just use the web interface and create a dashboard of the devices that are down they are responsible for? 

I have used pop ups in the past but with 2008 and windows 7 it was much easier just to create the dashboards.


OfflinePhoto of Norman F Norman F said 2 years ago

Hi Paul,

that would make things a lot easier, I can totally agree with you on that - however, the explicit requirement is for a pop-up which the Help Desk member should interact with to "get rid of it" and so acknowledging it ;-)

Saying you have used pop ups in the past: what did you use particularly? Past means 2003/XP and so the built-in WinPopup Action? Or did you find a solution to have multiple pop-ups being generated?


OfflinePhoto of Paul Byers Paul Byers said 2 years ago

At the time we were on 2003 and sent the popup to an XP machine.  I don't remember having an issue with not creating multiple popups.  Before we got rid of the popup we moved to an IE window instead of a windows popup.  (see below)

Set IE = CreateObject("InternetExplorer.Application")

With IE
      .visible=1
      .left=50
      .top=000
      .height=300
      .width=400
      .menubar=False
      .toolbar=False
      .addressBar=False
      .statusBar=False
      .FullScreen=False
      .navigate "CustomWebSiteToShow.html"
End With


OfflinePhoto of Norman F Norman F said 2 years ago

Hi Paul,

interesting idea, but unfortunately it behaves the same way my Windows pop-up script does: running it as a *.vbs file on the server brings up an IE window (instead of a Windows shell pop-up) but when using the same script as an Active Script Action nothing happens...


OfflinePhoto of Paul Byers Paul Byers said 2 years ago

Try calling the vbscript via a bat file.  If believe that is how I launched all my vb action scripts


OfflinePhoto of Norman F Norman F said 2 years ago

Hi Paul,

yep, also thought about that but unfortunately it didn't help.

Having a *.bat file including either "start C:\<folder>\<script>.vbs" or just "C:\<folder>\<script>.vbs" doesn't bring up the pop-up, neither the Windows Shell nor the IE.

EDIT: of course, using a Program Action then to execute the *.bat


OfflinePhoto of Paul Byers Paul Byers said 2 years ago

That is strange for once the IE window is open the vbscript should close and have the ability to run again.  can you run the script manually twice and get the popups?


OfflinePhoto of Norman F Norman F said 2 years ago

Well, the *.bat file itself works the way it should when executed manually, not as a WhatsUp Gold action.

What I meant was, that using the *.bat file as a Program Action won't do anything once again (same like the Active Script Action, where the script itself works executed manually but not as a WhatsUp Gold action).

EDIT: by the way both Program Action & Active Script Action work when being tested inside the WhatsUp Gold Action Library - they just won't work when applied to a device.

EDIT2: and yes, sorry - run manually, I can produce as many pop-ups as I want


OfflinePhoto of Paul Byers Paul Byers said 2 years ago

Apologies at this point I am at a loss to what could be causing it or a solution.  Not sure if support can give you a hand or not


OfflinePhoto of Norman F Norman F said 2 years ago

Good morning Paul,

never mind, thanks for you help so far, I really appreciate that!

Has anyone else an idea how to fix this? I doubt it's the script causing this issue. As mentioned above it works exactly the way it should executing it manually (*.vbs file) or testing it via the WUG Action Library.

Meanwhile I'll try to get in touch with NMSupport.


Would you like to comment?

You must be a member. Sign In if you are already a member.

  • 2,646 views
  • 5 versions
  • 14 replies
  • 3 followers
     
Avg. Rating:
Rating: 5out of5Igloo.Common.ObjectUserInfo
Posted By:
Norman F
 
July 12, 2012

Related Content

    Search this area

    About this forum

    • 313k views
    • 3510 topics
    • 62 followers
       

    Post questions and find answers for all things related to the Standard and Premium Editions of WhatsUp gold.


    Viewed 2,646 times