» Site Navigation |
|
|
» Stats |
Members: 9,303
Threads: 11,614
Posts: 54,720
Top Poster: Nick (4,977)
|
| Welcome our newest member, prem kapoor |
» February 2010 |
| S |
M |
T |
W |
T |
F |
S |
| 31 |
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
| 1 | 2 | 3 | 4 | 5 | 6 |
|
 |
03-09-2007, 01:25 PM
|
#1 (permalink)
|
Status: Super Altiris Admin
Join Date: 06-14-2005
Location: USA
Posts: 429
|
Display a message on end users computer
Will display a message on end users computer...
The time out is set to 30 seconds and then asks if you want to display the message again, I tried to set it to a higher value (24 hours, 1 hour, 30 mins) but it still times out after less than 1 min (didn't time it to get the exact time)
Last edited by ksweet; 04-06-2008 at 07:57 PM..
|
|
|
03-10-2007, 12:18 PM
|
#2 (permalink)
|
Status: Altiris Engineer (Super Mod)
Join Date: 02-22-2005
Location: South Jordan, Utah, USA
Posts: 1,196
|
to me this is easily the best post of the year. Good find! Thanks for sharing!
__________________
______________________
Mike Ainsworth
|
|
|
03-14-2007, 08:40 AM
|
#3 (permalink)
|
Status: Altiris Admin
Join Date: 05-08-2006
Location: London, UK
Posts: 52
|
Having a little trouble getting this one going. The script doesn't display any errors, but the popup doesn't appear.
Any bright ideas about what might be missing?
Thanks!
__________________
Altiris Certified Engineer (ACE)
|
|
|
03-14-2007, 12:24 PM
|
#4 (permalink)
|
Status: Super Altiris Admin
Join Date: 06-14-2005
Location: USA
Posts: 429
|
If this reg key is set the script will work, show no errors but no message ballon will show on the client PC.
Remarks
This method only works if the Microsoft balloon feature is enabled in the registy. See http://support.microsoft.com/default...b;en-us;307729 for more information.
Code:
REGEDIT4
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"EnableBalloonTips"=dword:00000000
|
|
|
03-14-2007, 12:30 PM
|
#5 (permalink)
|
Status: Altiris Admin
Join Date: 05-08-2006
Location: London, UK
Posts: 52
|
That did the trick, thanks for your help!!
__________________
Altiris Certified Engineer (ACE)
|
|
|
03-14-2007, 01:10 PM
|
#6 (permalink)
|
Status: Junior Altiris Admin
Join Date: 02-21-2006
Location: Indianapolis
Posts: 22
|
Message on Computer
How are you guys sending this out. Can you feed it a list of computer names. I want to send out a "Please Restart Your Computer" type of message to several computers at the same time.
|
|
|
03-14-2007, 01:15 PM
|
#7 (permalink)
|
Status: Super Altiris Admin
Join Date: 02-21-2005
Location: Pennsylvania, USA
Posts: 152
|
Quote:
|
Originally Posted by RWChandler1949
How are you guys sending this out. Can you feed it a list of computer names. I want to send out a "Please Restart Your Computer" type of message to several computers at the same time.
|
I'm curious too - is this sent through the DS?
|
|
|
03-20-2007, 03:58 PM
|
#8 (permalink)
|
Status: Super Altiris Admin
Join Date: 02-21-2005
Location: Pennsylvania, USA
Posts: 152
|
Quote:
|
Originally Posted by jebba
I'm curious too - is this sent through the DS?
|
anyone?
|
|
|
03-20-2007, 04:04 PM
|
#9 (permalink)
|
Status: Altiris Engineer (Super Mod)
Join Date: 02-22-2005
Location: South Jordan, Utah, USA
Posts: 1,196
|
...or a SWDelivery Package/Policy (use 'cscript.exe yourvbs.vbs' in your program). or a task server task against a swd package.
__________________
______________________
Mike Ainsworth
|
|
|
03-21-2007, 01:21 PM
|
#10 (permalink)
|
Status: Super Altiris Admin
Join Date: 06-14-2005
Location: USA
Posts: 429
|
Quote:
|
Originally Posted by jebba
I'm curious too - is this sent through the DS?
|
You run this script on one computer to show a message on another computer.
Since the message is only displayed for 30 seconds I would not use it to alert users to important messages that they need to do something about...
for that I use this:
Code:
Set MyShell = WScript.CreateObject("WScript.Shell")
MyAnswer = MyShell.Popup("Can you read this message?", 0, "Read Me", vbOKOnly + vbCritical + vbSystemModal)
|
|
|
03-21-2007, 11:33 PM
|
#11 (permalink)
|
Status: Super Altiris Admin
Join Date: 02-21-2005
Location: Pennsylvania, USA
Posts: 152
|
I guess I'm saying HOW do you run the script? copy into a txt file - batch file??
thanks
|
|
|
03-22-2007, 02:42 AM
|
#12 (permalink)
|
Status: Altiris Engineer (Super Mod)
Join Date: 02-22-2005
Location: South Jordan, Utah, USA
Posts: 1,196
|
Like ksweet was explaining, the way he wrote the script you don't need to run it through anything.
Try copying the code into notepad and save to somefile.vbs
double-click it
tada! Read-up on vbscripting and you can take out the messagebox and run it as part of a DS job or NS task.
__________________
______________________
Mike Ainsworth
|
|
|
03-11-2008, 05:40 PM
|
#13 (permalink)
|
Status: Super Altiris Admin
Join Date: 10-28-2005
Location: Colorado
Posts: 1,350
|
Could someone correct me here. I would like to use this but with an array to message a group of computers. I don't know much vbs though.
1. Can I modify the object in the loop each time for a new computer?
2. How can I dynamically initialize an array -- Dim computers(x) ?
Here is what I have:
Code:
OnErrorResume Next
' 0 = No Icon
' 1 = Information Icon
' 2 = Warning Icon
' 3 = Error Icon
' 4 = Altiris
MyIcon = 2
' Set you your default message title
MyTitle = "Message from IT"
MyMessage = "Please wait until the backup has completed."
Dim computers(1)
computers(0)="computer1"
computers(1)="computer2"
ForEach item In computers
Set NSAgent = CreateObject("Altiris.AeXClient", computers(item))
Set SessionManager = NSAgent.SessionManager
Set Sessions = SessionManager.Sessions
Set Session = Sessions.Item(0)
MyReturn = Session.DisplayBalloon(MyTitle, MyMessage, MyIcon, 30, Nothing)
WScript.Sleep(3000)
Session.HideBalloon(MyReturn)
Next
Thanks!
__________________
Brandon
|
|
|
03-11-2008, 07:08 PM
|
#14 (permalink)
|
Status: Super Altiris Admin
Join Date: 02-24-2005
Location: Orange County, California, USA
Posts: 585
|
How are you piping the computer names to the vbscript?
Typically, you would use REDIM ARRAY(N)
And do a For/Each and increment N by 1
Quote:
Originally Posted by Brandon
Could someone correct me here. I would like to use this but with an array to message a group of computers. I don't know much vbs though.
1. Can I modify the object in the loop each time for a new computer?
2. How can I dynamically initialize an array -- Dim computers(x) ?
Here is what I have:
Code:
OnErrorResume Next
' 0 = No Icon
' 1 = Information Icon
' 2 = Warning Icon
' 3 = Error Icon
' 4 = Altiris
MyIcon = 2
' Set you your default message title
MyTitle = "Message from IT"
MyMessage = "Please wait until the backup has completed."
Dim computers(1)
computers(0)="computer1"
computers(1)="computer2"
ForEach item In computers
Set NSAgent = CreateObject("Altiris.AeXClient", computers(item))
Set SessionManager = NSAgent.SessionManager
Set Sessions = SessionManager.Sessions
Set Session = Sessions.Item(0)
MyReturn = Session.DisplayBalloon(MyTitle, MyMessage, MyIcon, 30, Nothing)
WScript.Sleep(3000)
Session.HideBalloon(MyReturn)
Next
Thanks!
|
__________________
IT Factotum * Altiris Addict * Wise Monger * VBScript Zealot
Jereme Dean
Orange County, CA
jdean33442@gmail.com
|
|
|
03-11-2008, 07:19 PM
|
#15 (permalink)
|
Status: Super Altiris Admin
Join Date: 10-28-2005
Location: Colorado
Posts: 1,350
|
We are actually going to set all the computers up for the site in the vbs, then we are going to execute it from BackupExec. You can run pre/post jobs to stop services and notify the users when the backup is going, then the post task restarts the services and notifies them again that it is done. I am looking for an alternative to NET SEND basically.
I am guessing I have an error because you can only createobject once. Is there such thing as ModifyObject so I can re-configure the instance of NSAgent each time through the loop?
EDIT:
This probably won't work though. I would have to wait 30 seconds between each machine getting the message. I may have to look into some alternatives because I think balloon tips are hidden on some of the machines. 
__________________
Brandon
Last edited by Brandon; 03-11-2008 at 07:26 PM..
|
|
|
04-06-2008, 07:58 PM
|
#16 (permalink)
|
Status: Super Altiris Admin
Join Date: 06-14-2005
Location: USA
Posts: 429
|
Much Much More Improved..
Code:
'********************
' Copyright (c) 2008
' by
' Kenneth Sweet
'********************
On Error Resume Next
'Message text to be displayed to the user
MsgText = "This Message will be displayed to the user." & vbCrLf & "Please click on the OK button."
'Title of message window
MsgTitle = "Message Window Title"
'How long to display the message window in number of seconds
'Setting MsgDelay to 0 will display the message till the user responds / clicks on a button
MsgDelay = 300
'How long to show message before updating the countdown time in the message displayed to the user
'if MsgDelay is set to 0 then CDDelay must also be set to 0
'if MsgDelay is set to ano other value CDDelay must either be equal to MsgDelay so that the countdown time does not update
' or less than MsgDelay so the countdown time updates on a regular basis
'if MsgDelay if greater than 0 then CDDelay can not be set to 0
CDDelay = 10
'Settings for how message window looks. Add values to get total
'Select one value from each group. Buttons, Icon, Default Button, Msg Window Modal and add them togeather
'MsgType
'Buttons
Const vbOKOnly = 0 'Display OK button only.
Const vbOKCancel = 1 'Display OK and Cancel buttons.
Const vbAbortRetryIgnore = 2 'Display Abort, Retry, and Ignore buttons.
Const vbYesNoCancel = 3 'Display Yes, No, and Cancel buttons.
Const vbYesNo = 4 'Display Yes and No buttons.
Const vbRetryCancel = 5 'Display Retry and Cancel buttons.
'Icon
Const vbCritical = 16 'Display Critical Message icon.
Const vbQuestion = 32 'Display Warning Query icon.
Const vbExclamation = 48 'Display Warning Message icon.
Const vbInformation = 64 'Display Information Message icon.
'Default Button
Const vbDefaultButton1 = 0 'First button is the default.
Const vbDefaultButton2 = 256 'Second button is the default.
Const vbDefaultButton3 = 512 'Third button is the default.
Const vbDefaultButton4 = 768 'Fourth button is the default.
'Msg Window Modal
Const vbApplicationModal = 0 'Application modal. The user must respond to the message box before continuing work in the current application.
Const vbSystemModal = 4096 'System modal. On Win16 systems, all applications are suspended until the user responds to the message box. On Win32 systems, this constant provides an application modal message box that always remains on top of any other programs you may have running.
'Use vbOKOnly (buttons) when calling ShowUserMsgProcess
MsgType = vbOKOnly + vbExclamation + vbDefaultButton1 + vbSystemModal
'used in ShowUserMsgProcess only
'Name of process to look for
ProName = "cmd.exe"
'Kill the proccess after count down or if user clicks OK
KillPro = True 'True or False
' *****************************************************************************
' * Start Sample Code Un-Rem one of the 2 lines below
' *****************************************************************************
'If a user is logged on show them a message
TempReturn = ShowUserMsg(MsgText, MsgTitle, MsgDelay, CDDelay, MsgType)
'If a user is logged on show them a message if a process is running
'TempReturn = ShowUserMsgProcess(MsgText, MsgTitle, MsgDelay, CDDelay, MsgType, ProName, KillPro)
'Exit script with Returned value
WScript.Quit TempReturn
' *****************************************************************************
' * End Sample Code
' *****************************************************************************
' *****************************************************************************
' * Display a mesg to user is anyone is logged on
' *****************************************************************************
'Return Values
'0 No user was logged on
'vbOK 1 OK button was clicked.
'vbCancel 2 Cancel button was clicked.
'vbAbort 3 Abort button was clicked.
'vbRetry 4 Retry button was clicked.
'vbIgnore 5 Ignore button was clicked.
'vbYes 6 Yes button was clicked.
'vbNo 7 No button was clicked.
'Custom 8 Timed out, automaticly closed
'Custom 9 Proccess failed to terminate
Function ShowUserMsgProcess(ByVal MsgText, ByVal MsgTitle, ByVal MsgDelay, ByVal CDDelay, ByVal MsgType, ByVal ProName, ByVal KillPro)
'Will show a logged on user a message if a user is currently logged on and a specific proccess is running
On Error Resume Next
TempReturn = 0
If MsgDelay > 0 And CDDelay = 0 Then
CDDelay = 10
ElseIf MsgDelay = 0 Then
CDDelay = 0
End If
Set MsgShell = WScript.CreateObject("WScript.Shell")
Do
ProRunning = FindProcess(".", ProName)
If ProRunning Then
If UserLoggedOn(".", UserName) Then
Do
If MsgDelay < CDDelay Then
CDDelay = MsgDelay
End If
TempReturn = MsgShell.Popup(MsgDelayText(MsgDelay, MsgText), CDDelay, MsgTitle, MsgType)
MsgDelay = MsgDelay - CDDelay
Loop While TempReturn = -1 And MsgDelay > 0
If KillPro Then
If Not(KillProcess(CompName, ProName)) Then
TempReturn = 9
End If
Else
TempReturn = 9
End If
Else
If KillPro Then
If Not (KillProcess(CompName, ProName)) Then
TempReturn = 9
End If
Else
TempReturn = 9
End If
End If
End If
Loop While ProRunning And TempReturn <> 9 And MsgDelay > 0
If TempReturn = -1 Then
TempReturn = 8
End If
ShowUserMsgProcess = TempReturn
End Function
Function ShowUserMsg(ByVal MsgText, ByVal MsgTitle, ByVal MsgDelay, ByVal CDDelay, ByVal MsgType)
'Will show a logged on user a message if a user is currently logged on, displayed message will have a timmer that will count down
On Error Resume Next
TempReturn = 0
If MsgDelay > 0 And CDDelay = 0 Then
CDDelay = 10
ElseIf MsgDelay = 0 Then
CDDelay = 0
End If
Set MsgShell = WScript.CreateObject("WScript.Shell")
If UserLoggedOn(".", UserName) Then
Do
If MsgDelay < CDDelay Then
CDDelay = MsgDelay
End If
TempReturn = MsgShell.Popup(MsgDelayText(MsgDelay, MsgText), CDDelay, MsgTitle, MsgType)
MsgDelay = MsgDelay - CDDelay
Loop While TempReturn = -1 And MsgDelay > 0
End If
If TempReturn = -1 Then
TempReturn = 8
End If
ShowUserMsg = TempReturn
End Function
Function MsgDelayText(ByVal MsgDelay, ByVal MsgText)
'Returns Message text with remaining time added on to the end
TempReturn = MsgText
If MsgDelay > 0 Then
MsgHour = Int(MsgDelay / 3600)
MsgDelay = MsgDelay Mod 3600
MsgMin = Int(MsgDelay / 60)
MsgSec = MsgDelay Mod 60
TempReturn = TempReturn & vbCrLf & vbCrLf & "This message will automaticly close in " & RetTime(MsgHour, MsgMin, MsgSec)
End If
MsgDelayText = TempReturn
End Function
Function RetTime(ByVal TempHour, ByVal TempMin, ByVal TempSec)
'Returns imputed time as a string Hours, Minutes, and Seconds - 00:00:00
RetTime = Num2Str(TempHour) & ":" & Num2Str(TempMin) & ":" & Num2Str(TempSec)
End Function
Function Num2Str(ByVal TempNum)
'Returns number as a 2 character string
Num2Str = Right("00" + CStr(TempNum), 2)
End Function
Function UserLoggedOn(ByVal CompName, ByRef UserName)
'Return Values
'-1 or True - A User is logged on
'0 or False - No user was logged on
On Error Resume Next
TempReturn = False
UserName = Null
If ConnectWMI(CompName, "root\CIMV2", "", "", WMIConnection) Then
Set ComputerInfo = WMIConnection.ExecQuery("SELECT UserName FROM Win32_ComputerSystem",, 48)
For Each User In ComputerInfo
If Not IsNull(User.UserName) Then
UserName = User.UserName
TempReturn = True
End If
Next
End If
UserLoggedOn = TempReturn
End Function
Function KillProcess(ByVal CompName, ByVal ProName)
On Error Resume Next
TempReturn = False
If ConnectWMI(CompName, "root\CIMV2", "", "", WMIConnection) Then
TempReturn = True
'Get collection of all ProcessIDs where the name matches ProName
Set ProcessList = WMIConnection.ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" & ProName & "'",, 48)
'Loop through entire collection
For Each TempProcess In ProcessList
If TempProcess.Terminate() = 0 Then
WScript.Sleep(1000)
If FindProcess(CompName, ProName) Then
TempReturn = TempReturn And False
Else
TempReturn = TempReturn And True
End If
Else
TempReturn = TempReturn And False
End If
Next
End If
KillProcess = TempReturn
End Function
Function FindProcess(ByVal CompName, ByVal ProName)
On Error Resume Next
TempReturn = False
If ConnectWMI(CompName, "root\CIMV2", "", "", WMIConnection) Then
TempReturn = False
'Get collection of all ProcessIDs where the name matches ProName
Set ProcessList = WMIConnection.ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" & ProName & "'",, 48)
'Loop through entire collection
For Each TempProcess In ProcessList
If LCase(TempProcess.Name) = ProName Then
TempReturn = True
End If
Next
End If
FindProcess = TempReturn
End Function
Function ConnectWMI(ByVal CompName, ByVal NameSpace, ByVal UserName, ByVal Password, ByRef WMIConnection)
On Error Resume Next
Set WSNetwork = CreateObject("Wscript.Network")
If LCase(CompName) = LCase(WSNetwork.ComputerName) Then
UserName = ""
Password = ""
End If
Set SWbemLocator = CreateObject("WbemScripting.SWbemLocator")
If Err.number = 0 Then
Set WMIConnection = SWbemLocator.ConnectServer(CompName, NameSpace, UserName, Password)
If Err.number = 0 Then
WMIConnection.Security_.impersonationlevel = 3
ConnectWMI = True
Else
Err.Clear
ConnectWMI = False
End If
Else
Err.Clear
ConnectWMI = False
End If
End Function
|
|
|
05-01-2009, 02:25 PM
|
#17 (permalink)
|
Status: Junior Altiris Admin
Join Date: 02-07-2008
Location: Cinci, OH.
Posts: 22
|
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
|
|
|
 |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|