Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » Adsi » VBScript » Create a new Computer object - vbscript sample

Create a new Computer object - vbscript sample

Active Directory Services Interface (ADSI) is a set of COM (Common Object Model) programming Interfaces. Like ODBC, ADSI provides common access to directories by adding a provider for each directory protocol type.

You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.

On this site, you can find many ADSI samples.

The Computer ADSI class can be used in ActiveXperts Network Monitor to monitor your servers.


Computer

Example(s)

strContainer = ""
strName = "EzAdComputer"

'***********************************************
'*         Connect to a container              *
'***********************************************
Set objRootDSE = GetObject("LDAP://rootDSE")
If strContainer = "" Then
  Set objContainer = GetObject("LDAP://" & _
    objRootDSE.Get("defaultNamingContext"))
Else
  Set objContainer = GetObject("LDAP://" & strContainer & "," & _
    objRootDSE.Get("defaultNamingContext"))
End If
'***********************************************
'*       End connect to a container            *
'***********************************************

Set objComputer = objContainer.Create("computer", "cn=" & strName)
objComputer.SetInfo