Hello Guys,
I have been suffering around for like 3 days on Forums and Google and it's killing me I almost clicked each google page what's starting with OSD SCCM VBS and Computername. I hope you can help me with my small issue.
I am trying to search trough AD for the Next available computer name. Example:
PC-001
PC-002
PC-004
PC-005
So when I deploy an Unknown System he should get OSDCOMPUTERNAME PC-003.
I have found some web service solutions for this problem but doesn't know really how to implement it with IIS and MDT.
If somebody has a nice tutorial it would be nice or else I prefer also a vbsscript for this. I already got a script that is looking if the computer is having minint I am using this for Known computers.
Here is also a script that is looking for the last computername but it's still not what I am looking for:
Const adUseClient = 3
strDept = InputBox("Enter Department","","DEPT")
Set objRootDSE = GetObject("LDAP://RootDSE")
strDomainDN = objRootDSE.Get("defaultNamingContext")
Set Conn = CreateObject("ADODB.Connection")
Set Comm = createobject("ADODB.Command")
Set RS = CreateObject("ADODB.Recordset")
strQuery = "<LDAP://" & objRootDSE.Get("defaultNamingContext") & _
">;(&(objectCategory=computer)(objectClass=computer)(name=" & strDept & "*));ADsPath,samAccountName;subtree"
Conn.Provider = "ADsDSOObject"
Conn.Open "ADs Provider"
Conn.CursorLocation = adUseClient
Comm.ActiveConnection = Conn
Comm.Properties("Page Size") = 1000
Comm.CommandText = strQuery
Comm.Properties("Sort on") = "samAccountName"
Set rs = comm.Execute
While Not rs.EOF
rs.movelast
strComputer = rs("samAccountName")
rs.MoveNext
Wend
I hope you guys can help me with this problem.
Thank you !
Greetz,
Zoran