Registered member login:
Register Now
Altirigos » Homepage2

» Current Poll
Do you leave the Aclient enabled?
YES - 82.31%
107 Votes
NO - 17.69%
23 Votes
Total Votes: 130
You may not vote on this poll.
» Stats
Members: 9,496
Threads: 11,750
Posts: 55,294
Top Poster: Nick (4,981)
Welcome our newest member, JessicaD
» Online Users: 25
0 members and 25 guests
No Members online
Most users online at once 294, 06-30-2007 at 12:24 PM.
» March 2010
S M T W T F S
28 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 123
View Single Post
Old 05-01-2009, 01:25 PM   #17 (permalink)
masonje
 
Status: Junior Altiris Admin
Join Date: 02-07-2008
Location: Cinci, OH.
Posts: 24


Balloon when user not logged in

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
__________________
The government's view of the economy could be summed up in a few short phrases: If it moves, tax it. If it keeps moving, regulate it. And if it stops moving, subsidize it.
- Ronald Reagan
masonje is offline   Reply With Quote
 
Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -4. The time now is 08:55 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
vB.Sponsors
Altirigos