Using VBS To Find All Objects Which Match an LDAP Filter
Posted on 2004-09-15
I'm writing a script which updates all the Exchange SMTP virtual servers to point to a specific smarthost. Basically, I need to find all objects that have attributes equal to "objectClass: top; protocolCfg; protocolCfgSMTP; protocolCfgSMTPServer;" and then set the msExchSmtpSmartHost = to something.
I realize this isn't the Exchange forum, so don't worry so much about the exchange stuff and treat it just like a VBS query for all objects that meet the query and then set the value.
I know how to set the value if I already know the DN of the object, but I would like to connect to AD without having to specify a server or possible even a domain. Tthis has to work in multiple deployments so the domain will change, but I'll be running it on a computer in that domain so I could use an environment variable to get the current domain.
Make sense? I'm sure there are a ton of examples and I know that search.vbs that comes with the support tools has a some code, I just don't have time to figure out the filtering stuff, etc.