Workstation naming in ZTI (Full Version)

All Forums >> [Management Products] >> Operating System Deployment



Message


EdwardKK -> Workstation naming in ZTI (4/25/2008 5:47:14 PM)

When using RIS, if I image a machine I can give it a dynamic name.  For example, Denver001, Denver002, etc.  So if I'm imaging 4 machines they will all get new names based on what's available in the domain 001, 002, 003, 004 etc.  I see in the Deployment workbench that i can assign a unique workstation name to a location, which is great, but I'd like to also give it the sequential number afterwards, so all workstation in Denver get the "Denver" prefix and a number assigned (001, 002, etc).  Is there a handy little trick i can use to have a workstation get a sequential name like Ris allows me to do?  I can run a script to rename it, it just seems obvious that there probably a way to do this in BDD without needing custom scripting.




eschloss -> RE: Workstation naming in ZTI (4/29/2008 10:14:15 AM)

see http://www.server-management.co.uk/index.php?option=com_content&task=view&id=335&Itemid=62

scroll to the bottom and read the Favourite names section.

It discusses a method of using a stored procedure in the BDD database to generate names.




EdwardKK -> RE: Workstation naming in ZTI (5/22/2008 3:50:12 PM)

I took a look at this, but I'm not sure how to get these to integrate with our previous RIS environment.

We have a large installed base of computers, and most of my imaging is going to be new machines that need an image.  As a result, I need a solution very similar to what we have in RIS.  Our workstations are named based on a department+City+WK+sequential number.  So a machine in NYC has a name like ACCTNYCWK001   as an example.  When we use RIS, we can set it up and have all workstations use that prefix and just get the next available number in AD.. eg 001, 002, 003, 004, etc.  It keeps things simple. 

I'm concerned in that if I use another BDD database to track these, I'll end up with duplicate machine names.  How would the deployment bb, know there is a workstation in use that hasn't been deployed using the system?  I wont be re-imaging all systems for a while. 

What I need is a way to have ZTI do a query against AD just like RIS does and generate the machine names using the same models.  I can construct a script to rename the workstations based on their locations, but I need to know how to query AD to find the next available sequential name that's available.   It seems silly that there isn't a simple way to do this using the deployment toolkits. 

Does anyone have any idea how to script something that will rename a workstation using the same query methods that RIS would use? 
or is there a simply way to use something like "AcctNYCWK#03%" in the toolkits like we can in RIS without having to build duplicate dbs?




rbennett806 -> RE: Workstation naming in ZTI (5/22/2008 5:37:35 PM)

Unfortunately I haven't been able to tinker with RIS in our environement, so I'm not sure exactly what code you'd need. Right now I'm still polishing up an .HTA frontend for our bare metal SCCM machines that will poll Active Directory to detemine if there's an available incremental machine name (and then it polls SCCM to see if it's available there too). So if you think that VBScript code might work for you I can try to toss up my "draft" .HTA with all the code in it. Just let me know (and hope I've got some free time to post it).

Basically I think you might need to do something like the following (of course this is part of a larger script, but it might point you in the right direction)...
If strDomainCheck = "not bound to Active Directory" Then
   Log ("Attemping to connect to the AD environment using LDAP with alternate credentials")
   ' Need to bind to a domain controller when using alternate credentials.
   Set objNS = GetObject("LDAP:")
   Log ("Attempting to access " & strDomainControllerFQDN & "to obtain the LDAP information")
   Set objRootDSE = objNS.OpenDSObject("LDAP://" & strDomainControllerFQDN & "/RootDSE", strUserName, strPassword, ADS_SERVER_BIND Or ADS_SECURE_AUTHENTICATION)
   strDNSDomain = objRootDSE.Get("defaultNamingContext")
   Log ("Connected to " & strDNSDomain)
   Log ("Attempting to use ADO to search Active Directory")
   Set adoCommand = CreateObject("ADODB.Command")
   Set adoConnection = CreateObject("ADODB.Connection")
   adoConnection.Provider = "ADsDSOObject"
   adoConnection.Properties("User ID") = strUserName
   adoConnection.Properties("Password") = strPassword
   adoConnection.Properties("Encrypt Password") = True
   adoConnection.Properties("ADSI Flag") = ADS_SERVER_BIND Or ADS_SECURE_AUTHENTICATION
   adoConnection.Open "Active Directory Provider"
   adoCommand.ActiveConnection = adoConnection
   Log ("Opened a connection to the Active Directory Provider")
   adoCommand.CommandText = "Select Name from 'LDAP://" & strDomainControllerFQDN & "/" & strDNSDomain & "' " & "Where objectCategory='Computer'"
   adoCommand.Properties("Page Size") = 100
   adoCommand.Properties("Timeout") = 30
   adoCommand.Properties("Cache Results") = False
   Log ("Executing the ADO query command")
   Set adoRecordset = adoCommand.Execute
   Log ("Obtained the filtered list of Active Directory computers")
Else
   Log ("Binding to the Active Directory domain environment using WINNT")
   Set dso = GetObject("WinNT:")
   Set objDomain = dso.OpenDSObject("WinNT://" & strDomainSuffix, strUserName, strPassword, ADS_SECURE_AUTHENTICATION)
   objDomain.Filter = Array("computer")
   Log ("Obtained the filtered list of Active Directory computers")
End If


And some more code..
Sub CheckForADComputerObject
' Attempts to determine if the current machine name already exists within the Active Directory environment by trying to find a name match within the domain.
Dim objDomainItem
Log ("Searching Active Directory to determine if " & strComputerName & " already exists")
Pause (1) : ' Pauses for 1 second to allow the HTA log to be refreshed before continuing.
For Each objDomainItem In objDomain
   If UCase(objDomainItem.Name) = UCase(strComputerName) Then
       strADmatch = "FOUND"
       Exit For
   End If
Next
If strADmatch = "UNKNOWN" Then
   Log (strComputerName & " is available within Active Directory")
   strADmatch = "NOT FOUND"
Else
   Log (strComputerName & " already exists within AD")
End If
End Sub

Sub CheckForADComputerObjectALTERNATE
' Attempts to determine if the current machine name already exists within the Active Directory environment by trying to find a name match within the domain.
Log ("Searching Active Directory to determine if " & strComputerName & " already exists")
strADmatch = "UNKNOWN"
Do Until adoRecordset.EOF
   If UCase(adoRecordset.Fields("Name").Value) = UCase(strComputerName) Then
       strADmatch = "FOUND"
       Exit Do
   End If
   adoRecordset.MoveNext
Loop
If strADmatch = "UNKNOWN" Then
   Log (strComputerName & " is available within Active Directory")
   strADmatch = "NOT FOUND"
Else
   Log (strComputerName & " already exists within AD")
   strSCCMcheck = "TRY AGAIN"
End If
End Sub

Some of that's rough code as I'm still polishing and testing. So hopefully that doesn't simply confuse you and fill up extra space in this post...




EdwardKK -> RE: Workstation naming in ZTI (5/23/2008 1:48:03 PM)

Well of COURSE it confuses me.  That's part of the fun.  But thanks for the ideas.  I can probably hack my way through if I have to.  It might just be easier to let the admins rename them.





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.34375