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!
|