3 Replies Latest reply on Sep 13, 2011 8:56 AM by brudog56

    Using sbadmdll with vbscript

      Hi,

       

      I was hoping someone could provide me with some sample code to illustrate how to use sbadmdll in vbscript.  For instance, lets say I just want to get my machine's object name.  With the executable, I would do this:

       

      sbadmcl.exe -command:GetLocalMachineName -adminuser:[user]  -adminpwd:[password]

       

      Can someone show me how I would d the equivalent in vbs using the DLL?

       

      Thanks,

      Mike

        • 1. Re: Using sbadmdll with vbscript

          something similar - createuser. Make sure you have the COM object registered of course..

           

          ' simple script to create a user using the SBAdmCOM.dll and COM api. 
          ' you must have this registered, as well as the file sbadmdll.dll - both should usually
          ' be in the EEPC5 client directory. 

          ' to register, use regsvr32 sbadmcom.dll from an admin command prompt if you are not 
          ' registering the API as part of a normal EEPC file deployment (self-registering dll type). 

          ' example script only by Simon Hunt, CTO McAfee - no support, warranties etc. 
          ' you can get help though on the encryption forum at http://community.mcafee.com


          OptionExplicit

          ' set up some simple XML 

          Dim XML

          ' this uses the stored credentials in sbserver.ini, so you'd run this on a machine configured to
          ' run sbdbserver.exe as a service.
          'XML="<SafeBoot><SbAdminScripting>" & _ 
          '   "<SBAdminConnection><ConnectionType>Persistent.New</ConnectionType>" & _
          '   "<AuthType>UserIDKeyFile</AuthType>" & _
          '   "<UserIDKeyFile>sbserver.ini</UserIDKeyFile>" & _
          '   "</SBAdminConnection>" & _
          '   "<SbAdminCommand><Command>CreateUser</Command>" & _
          '   "<User>-user-</User><Group>-group-</Group>" & _
          '   "<CommandRef>my_reference_string</CommandRef><ResultCode>0x00000000</ResultCode >" &  _
          '   "<ResultDescription>Success</ResultDescription></SbAdminCommand></SbAdminScript ing></SafeBoot>"

          ' this version uses stored userid and password. Other methods let you use adminauth etc. See
          ' the scripting guide for details.  
          XML="<SafeBoot><SbAdminScripting>" & _
              "<SBAdminConnection><ConnectionType>Persistent.New</ConnectionType>" & _
              "<AuthType>Usernamepassword</AuthType>" & _
              "<AdminUser>admin</AdminUser><AdminPWD>pass</AdminPWD>" & _
              "</SBAdminConnection>" & _
              "<SbAdminCommand><Command>CreateUser</Command>" & _
              "<User>-user-</User><Group>-group-</Group>" & _
              "<CommandRef>my_reference_string</CommandRef><ResultCode>0x00000000</ResultCode> " &  _
              "<ResultDescription>Success</ResultDescription></SbAdminCommand></SbAdminScripti ng></SafeBoot>"    
                  
          ' Connect to the COM object
          Dim SBObj : Set sbobj = CreateObject("SbAdmCom.SbAdmScripting")

          ' Set some values - could do this with the XML parser, but this is easier. 
          XML = Replace(XML,"-user-","test user name")
          XML = Replace(XML,"-group-","Endpoint Encryption Users")
          XML = Replace(XML,"><",">" & vbCrLf & "<")

          WScript.Echo"Sending:" & vbCrLf & xml

          ' run the command and retrieve the result
          Dim result : result = sbobj.execute(XML)

          ' show the result. 

          WScript.Echo"Recieved: " & vbCrLf & result



          • 2. Re: Using sbadmdll with vbscript

            Perfect, thanks!

            • 3. Re: Using sbadmdll with vbscript

              By the way, the DLLs don't install with the EEPC client, however you can copy them from any machine which has the manager installed and drop them in the EEPC program directory.