We found in our software delivery packages that if you don't have any one logged in for the software delivery, the script hangs on the balloon and the agent stops the task when it hits the timeout. Here is the code we created to get around this. Hope this helps...
Code:
set objAltirisAgent = nothing
Set objWshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'check for the altiris agent. If exists, the objAltirisAgent object is set
dim strAltirisDir, strAltirisReg
strAltirisDir = "c:"
strAltirisReg = "HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Altiris Agent\InstallDir"
if RegVerify(strAltirisReg) then
strAltirisDir = objWshShell.RegRead(strAltirisReg)
end if
If objFSO.FileExists(strAltirisDir & "\AeXAgentActivate.exe") Then
set objAltirisAgent = CreateObject("Altiris.AeXClient")
else
set objAltirisAgent = Nothing
End if
'code here
AltirisBubble "Title", "Message Here", 3, 30
wscript.quit()
'end code
'start sub
Public Function RegVerify(ByVal sRegEntry)
On Error Resume next
Dim WSH, sKeyTmp
Set WSH=CreateObject("WScript.Shell")
sKeyTmp = WSH.RegRead (sRegEntry)
if err.number=0 then
RegVerify = True
Addlog objFile, sRegEntry & " was found",Talk
else
RegVerify = False
Addlog objFile, sRegEntry & " was NOT found",Talk
end if
err.clear
On Error goto 0
End Function
Sub AltirisBubble(strTitle, strMsg, intIcon, intTime)
if numLoggedinUsers() > 0 then
if not objAltirisAgent is nothing then
dim sessmgr, sessions, session, cookie
set sessmgr = objAltirisAgent.SessionManager
set sessions = sessmgr.Sessions
Set session = sessions.Item ( 0 )
'intIcon info
' 0 = No Icon
' 1 = Information Icon
' 2 = Warning Icon
' 3 = Error Icon
' 4 = Altiris
cookie = session.DisplayBalloon ( "", "", intIcon, 0, Nothing)
WScript.Sleep 10
cookie = session.DisplayBalloon ( strTitle, strMsg, intIcon, intTime, Nothing)
'AddLog objFile, "Altiris balloon: " & strTitle & ", " & strMsg & ", " & intIcon & ", " & intTime,Talk
set sessmgr = Nothing
set sessions = Nothing
set session = Nothing
end If
else
'AddLog objFile, "No user logged in for Altiris Bubble"
end if
End Sub
'returns the number of users logged on
function numLoggedinUsers()
Dim objWMIService
Dim intUserLoggin
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
intUserLoggin = 0
For Each objComputer in colComputer
if objComputer.UserName <> "" then
intUserLoggin = intUserLoggin + 1
end if
Next
numLoggedinUsers = intUserLoggin
end function