ScriptedIT Posted October 24, 2007 Share Posted October 24, 2007 I've looked though ADFunctions and it does this for users but not computers. There is also a "create the computer and then see if it complained it already existed." Still I just want to know if it exists. Is this possible? Link to comment Share on other sites More sharing options...
weaponx Posted October 25, 2007 Share Posted October 25, 2007 I found this vbscript snippet which might give some hints. CODEFunction isComputerAccountExists(host) Dim conn, cmd , rs Set conn = CreateObject("ADODB.Connection") Set cmd = CreateObject("ADODB.Command") conn.provider = "adsdsoobject" conn.open "active directory provider" cmd.activeconnection = conn cmd.commandtext = ";(&(objectcategory=computer)(objectclass=computer)(cn=" & host & "));cn;subtree" Set rs = cmd.Execute If rs.recordcount = 0 Then isComputerAccountExists = False Else isComputerAccountExists = True End If End Function Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now