What I’ve been struggling with the last days are to auto generate names to unknown computers being installed with a new Win7 image. I came across http://www.deployvista.com/Home/tabid/36/EntryID/120/language/en-US/Default.aspx
Which solved my naming issue… Good work Johan Arwidmark:)
But I still had one issue left; the OU structure is more complex than just location or type. I need to put the computers in an OU structure based on location and type of client.
The OU structure is like this; OU=ComputerType,OU=Computers,OU=Location, DC=domain,DC=local.
To resolve this issue, I’ve expanded the stored procedure Johan created, and created an extra table to store the following info:
- Location – The name of you Location example: New York
- Gateway IP – The same as MDT. What Gateway identifies the New York location
- Shortname – The shortname of location for use in computername example: NY
- BaseOU – the OU string for this location: OU=Computers,OU=New York,OU=Locations,DC=domain,DC=local
In addition you need to change the MachineObjectOU column in the MDT settings table to more than 50 characters. I used 255 since I know my OU paths aren’t longer than that. But in my case 50 characters are too short.
Based on the information above the stored procedure will create a computer name sequentially in the following format PCLOCATIONSEQUENCE, example PCNY00001. The computer account will also be created in the OU=Laptop,+BaseOU or OU=Desktop,+BaseOU or OU=VM,+BaseOU based on the %islaptop%, %isdesktop% or %isvm% parameters in MDT.
To change the naming convention for the computer name, edit the stored procedure to change the order or add hyphens (-) for segmentation.
In the MDT/SCCM task sequence you need to use the %OSDDomainOUName% and not the %machineobjectOU%
I’m not a SQL guy, so the code might be a mess, but it’s working. I’ll try to rewrite the procedure to optimize the code. But I don’t know when it will be finished.
Download files here:
Run the scripts on you MDT database and add the following configure to your current Customsettings.ini:
Parameters=UUID, AssetTag, SerialNumber, MacAddress