Have you thought about using dsquery and dsmod instead? "Stefano" <Stefano[ at ]discussions.microsoft.com> wrote in message news:CACCE309-2A83-4CC4-9BD7-BF48D793F864[ at ]microsoft.com...
[Quoted Text] > > I'm trying to create a script to find a user object in AD anche change its > status to disabled . > > The problem is that I found only exmaple in which the OU in which the user > resides is known . As in > Set objUser = GetObject _ > ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com") > > This is useless , however , because we cannot know where the user is . > So I found another example ( which tests if a user exist in AD ) > > objCommand.CommandText = _ > "<LDAP://dc=matrix,dc=loc>;(&(objectCategory=User)" & _ > "(samAccountName=" & strUserName & "));samAccountName;subtree" > > Set objRecordSet = objCommand.Execute > > My problem is : how can I use the results from the second example to > disable > the user ? > Is there another ( better ) way of doing it ? > > Thanks > Stefano > > > >
|