cancel
Showing results for 
Search instead for 
Did you mean: 
Markus_Koestler
Moderator
Moderator
   VIP   
4 VBS scripts for your use:

Emailconfig.vbs - Set SMTP notification options
By default an anonymous SMTP connection is used to send the e-mails containing errors and warnings with high priority only.
You can specify the target e-mail adress, the SMTP server adress and the sender e-mail adress.

InstallLicense.vbs - Activate BESR agent

FullBackup.vbs - Create full backup job of drive C:\ and D:\
You can specifiy where you want the backup to be stored (locak or network) and when the backup should run

FullIncBackup.vbs - Create full and incremental backup job of drive C:\ and D:\
You can specifiy where you want the backup to be stored (locak or network), when the backup should run and on which day the full backup should run

Comments
Will_C_
Level 0
Thanks for posting.

I'm trying to make sure that our BESR clients are configured properly for e-mail notification.  We have been doing it manually.  Most are configured properly, but some haven't been configured at all.

Do you know if a way to retrieve the settings programatically?  I couldn't find any scripting examples for fetching settings, just for setting them.  I tried to crack open the object in VB.NET and figure it out, but it kept crashing on the .Connect method, so I guess I need to stick with VBScript for now.  Is anyone aware of a source for more documentation on BESR automation?
Will_C_
Level 0

Thanks - The documentation was a bit shabby on our current version's CD, but the 9.x release had much better notes (examples were still a bit thin).  I got it working last night using something similar.

FYI: In your example, it looks like you need to rename "Sub SetupEmail" to "Sub GetEmail".

I modified mine to accept a computer name on the command line, and it seems to work well for checking remote systems.  I wrapped it in a CMD file (using FIND) to compare actual values to the correct values to help detect misconfigured systems.  Now, I'm ironing out the kinks getting SCCM to check all our systems out and report what it finds.


---------------------

 Option Explicit
 
 Dim v2iAuto
 Dim oNet
 Dim emailAddress
 Dim emailServer
 Dim emailAddressfrom
 Dim targetComputer

 
On Error Resume Next
 '' get any command line arguments
' If WScript.Arguments.Count < 2 Then
'  WScript.Echo "Usage: cscript.exe Emailconfig.vbs emailaddress SMTPserver emailaddressfrom"
'  WScript.Quit
' End If
'Determine which computer to connect to - local if not specified.
If WScript.Arguments.Count < 1 Then
 Set oNet = CreateObject("Wscript.Network")
 targetComputer=oNet.ComputerName
Else
 targetComputer=WScript.Arguments(0)
End If
 '' Step 1: Create a V2iProtector Automation object
 Set v2iAuto = CreateObject("Symantec.ProtectorAuto")
 
 '' Step 2: Connect to the local agent
 WScript.Echo "Connecting..."
 v2iAuto.Connect targetComputer
 WScript.Echo Err.Description
 If Err <> 0 Then HandleErr Err.Number, Err.Description, Err.Source
 WScript.Echo "Connected..."
 '' Step 6: Set up email
' Call SetupEmail(v2iAuto, emailAddress, emailServer, emailAddressfrom)
 Call GetEmail(v2iAuto)
'' Step 5: Get email notifications
Sub GetEmail(v2iAuto)
 Dim CLSID_NOTIFY_HANDLER_EMAIL '' identifier of the email notification handler
 Dim DISPID_NOTIFY_HANDLER_TYPE '' identifier of the email handler's type filter
 Dim DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS '' identifier of the email handler's address property
 Dim DISPID_NOTIFY_PROPERTY_EMAIL_SERVER  '' identifier of the email handler's server property
 Dim DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS_FROM '' identifier of the email handler's address from property
 Dim DISPID_NOTIFY_SMTP_AUTH   '' identifier of the smtp authentication type
 
 CLSID_NOTIFY_HANDLER_EMAIL = "{69EB42D1-2701-437A-BFA4-EDA0042E2F0F}"
 DISPID_NOTIFY_HANDLER_TYPE = 258
 DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS = 512
 DISPID_NOTIFY_PROPERTY_EMAIL_SERVER = 513
 DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS_FROM=515
 DISPID_NOTIFY_SMTP_AUTH = 516
 
 WScript.Echo "Email To:     " & v2iAuto.GetNotificationProperty(CLSID_NOTIFY_HANDLER_EMAIL, DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS)
  WScript.Echo "Email From:   " & v2iAuto.GetNotificationProperty(CLSID_NOTIFY_HANDLER_EMAIL, DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS_from)
 WScript.Echo "Email Server: " & v2iAuto.GetNotificationProperty(CLSID_NOTIFY_HANDLER_EMAIL, DISPID_NOTIFY_PROPERTY_EMAIL_SERVER)
 WScript.Echo "Handler Type: " & v2iAuto.GetNotificationProperty(CLSID_NOTIFY_HANDLER_EMAIL, DISPID_NOTIFY_HANDLER_TYPE) '' errors and warnings
 WScript.Echo "Auth type:    " & v2iAuto.GetNotificationProperty(CLSID_NOTIFY_HANDLER_EMAIL, DISPID_NOTIFY_SMTP_AUTH) '' anonymous

end Sub
 
Sub HandleErr(ErrNum, ErrDesc, ErrSrc)
 'Handle errors
 WScript.Echo("Error [" & ErrNum & "]: """ & ErrDesc & """ @" & ErrSrc)
 WScript.Quit(ErrNum)
End Sub
Markus_Koestler
Moderator
Moderator
   VIP   

Documentation for BESR automation is provided on the product CD in the DOC\Automation folder. Regarding you issue, give this one a try:

    Option Explicit
    
    Dim v2iAuto
    Dim oNet
    Dim emailAddress
    Dim emailServer
    Dim emailAddressfrom


    '' Step 1: Create a V2iProtector Automation object
    Set v2iAuto = CreateObject("Symantec.ProtectorAuto")
    
    '' Step 2: Connect to the local agent
    Set oNet = CreateObject("Wscript.Network")
    WScript.Echo "Connecting..."
    Call v2iAuto.Connect(oNet.ComputerName)

    '' Step 6: Set up email
    Call GetEmail(v2iAuto)
    
    
'' Step 5: Get email notifications options
Sub GetEmail(v2iAuto)
    
    '' the CLSID of the email notification handler (progid will not work)
    Dim CLSID_NOTIFY_HANDLER_EMAIL    '' identifier of the email notification handler
    Dim DISPID_NOTIFY_HANDLER_TYPE    '' identifier of the email handler's type filter
    Dim DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS    '' identifier of the email handler's address property
    Dim DISPID_NOTIFY_PROPERTY_EMAIL_SERVER        '' identifier of the email handler's server property
    Dim DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS_FROM    '' identifier of the email handler's address from property
    Dim DISPID_NOTIFY_SMTP_AUTH            '' identifier of the smtp authentication type
    
    CLSID_NOTIFY_HANDLER_EMAIL = "{69EB42D1-2701-437A-BFA4-EDA0042E2F0F}"
    DISPID_NOTIFY_HANDLER_TYPE = 258
    DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS = 512
    DISPID_NOTIFY_PROPERTY_EMAIL_SERVER = 513
    DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS_FROM=515
    DISPID_NOTIFY_SMTP_AUTH = 516
    
    '' Get required email notification properties
    WScript.Echo "Email notifications setup on " & v2iAuto.ConnectedComputer
     WScript.Echo  v2iAuto.GetNotificationProperty(CLSID_NOTIFY_HANDLER_EMAIL, DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS)
     WScript.Echo v2iAuto.GetNotificationProperty(CLSID_NOTIFY_HANDLER_EMAIL, DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS_from)
     WScript.Echo v2iAuto.GetNotificationProperty(CLSID_NOTIFY_HANDLER_EMAIL, DISPID_NOTIFY_PROPERTY_EMAIL_SERVER)
     WScript.Echo v2iAuto.GetNotificationProperty(CLSID_NOTIFY_HANDLER_EMAIL, DISPID_NOTIFY_HANDLER_TYPE)    '' errors and warnings
 WScript.Echo  v2iAuto.GetNotificationProperty(CLSID_NOTIFY_HANDLER_EMAIL, DISPID_NOTIFY_SMTP_AUTH)    '' anonymous





End Sub


Will_C_
Level 0

Just curious, what tool (if any) did you use to extract all the properties from the DLL?


 CLSID_NOTIFY_HANDLER_EMAIL = "{69EB42D1-2701-437A-BFA4-EDA0042E2F0F}"
 DISPID_NOTIFY_HANDLER_TYPE = 258
 DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS = 512
 DISPID_NOTIFY_PROPERTY_EMAIL_SERVER = 513
 DISPID_NOTIFY_PROPERTY_EMAIL_ADDRESS_FROM=515
 DISPID_NOTIFY_SMTP_AUTH = 516

Markus_Koestler
Moderator
Moderator
   VIP   

Puh, well it is a long time ago since I wrote the script. I don't know which tool it was, sorry.

cege7249
Not applicable

hi

how to create the offsite copie using .vbs ??

you can do it by the wizard, and he added this text to the .pqj file :

(...)
<OffsiteLocation1 vt="9" clsid="{E8FF37B2-6B32-43E1-A801-BE4BCB22DCE0}">
  <Name vt="8">network</Name>
  <DisplayName vt="8">N&etwork file</DisplayName>
  <CountQuota vt="11">-1</CountQuota>
  <SizeQuota vt="11">0</SizeQuota>
  <Remote vt="11">-1</Remote>
  <FileSpec vt="8">DefaultOffsiteFile_MES</FileSpec>
  <Extension vt="8">.v2i</Extension>
  <DisplayPath vt="8">\\---SERVERNAME---\---SHAREDNAME---\</DisplayPath>
  <IsDedupeLocation vt="11">0</IsDedupeLocation>
  <NetworkUser vt="8">---DOMAIN---\---DOMUSER---</NetworkUser>
  <EncryptedPW2 vt="8">------Hidden------</EncryptedPW2>
  <AESPassword vt="8">------Hidden-----</AESPassword>
  </OffsiteLocation1>
(...)
 
thx
Markus_Koestler
Moderator
Moderator
   VIP   

You might check out the documentation in the automation folder of the product CD to find out wich object or property does the trick. The current vbs can not do it.

cege7249
Not applicable

I looking online because I don't have product CD, all of the BESR have been installed long time ago...
This option not seem to be used by the community :(

Markus_Koestler
Moderator
Moderator
   VIP   

I think if you download the trial version of BESR you'd get the documentation also.

cege7249
Not applicable

yes, it's was my intention, but need to do it at home cause of download rate limitation here :*)

I find in "automation\IImage5.html" file some informations :

these option seem to activate the fonctionnality :

VT_VOID AddOffsiteCopy(IImage newVal) Add an offsite copy of this image.

or maybe this option (Automation\IAgentAbilities5.html)

VT_BOOL OffsiteCopy Read Write Returns Whether allow offsite copy.

and this other, seem to authorize to 'do not prompt confirmation' (Automation\IImageJob5.html)

VT_BOOL EnableAutoSync Read Write Enable automatic synchronization of offsite copy locations.

but I'm not developper and don't understand howto where insert it in this script :\

 

and I need also a command to specify the path of the "offsite copy locations."

my offsite location is a windows share, with a special account (not domain user, local account). I must specify it also

above a screenshot of this option of the wizard

Markus_Koestler
Moderator
Moderator
   VIP   

Sorry, currently I don't have time to modify my script. But maybe you might be able to find someone with modest programming skills to do this for you.

Linas
Level 6

You spend all this money for an off the shelf management suite and now you need to find or pay a programmer to create or modify some script to do something this software is designed to do

I don’t get it Sorry.

TeleFragger
Level 5

thanks Markus for pointing me here..

not sure how to  utilize this though... we are using the Altiris CMS to manage SSR and the VBS would require some real tuning to get all 10 sites with 20 current backup policies working via vbs... with 0 user input...

 

still going to take a look.. thanks for posting up!

 

Version history
Last update:
‎06-01-2010 02:03 AM
Updated by: