Type mismatch...

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 16 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
redo
Posts: 6
Last visit: Fri Aug 17, 2007 8:29 pm

Type mismatch...

Post by redo »

Hi all:

I have writen the following code in LDAP way. My goal is to retrieve all computer accounts in contoso.com and pop up their account names. It returns a Type Mismatch error on "If sObject = "Computer"", can anybody help? Thank you.

Code: Select all

	Set oDomain = GetObject("LDAP://dc=contoso,dc=com")
	For Each oObject In oDomain
		sObject=oObject.get("objectClass")
		If sObject = "Computer" Then
			WScript.Echo oObject.get ("sAMAccountName")
		End If
	Next
redo2007-08-05 22:53:14
This topic is 16 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked