I couldn’t have gotten any of the following to work without the reading the blogs of the ever helpful:
Mikael Nystrom (@Mikael_Nystrom) http://www.deploymentbunny.com
Johan Arwidmark (@JArwidmark) http://www.deploymentresearch.com
along with twitter help from Peter Cashen (@PeterCashen).
This is for a Zero Touch OSD deployment.
Sometimes people name their devices using “device type-site location-number” as in LT-DUB-1234. What I’ve been trying to do is work out a way to dynamically name devices & put those devices into the correct OU during an OSD where the naming convention for OU’s is OU=Laptops, OU=Dublin, not OU=LT, OU=DUB for example.
Below is what I’ve come up with & while I’m sure there are other, better ways to do it, this is my 2c.
The device is named using the following string:
which for a laptop in Dublin, gives me LT-DUB-1234
The destination OU is Laptops not LT, so I’ve created a variable called DeviceType & used this to populate the variable with “Laptops” or “Desktops” depending on the device type.
I’ve then created a variable called OULocation & made that equal to the location string – either Dublin or Redmond, dependent upon the default gateway that’s been discovered.
I’ve had to add three custom properties to the INI:
The OU is dynamically made from the following:
So, in theory, the CS.ini running on a laptop in Dublin should populate the MachineObjectOU as follows:
OU=Laptops, OU=Dublin, OU=Computers,OU=ContosoGroup,DC=Contoso,DC=local.
And name the device as
This is my sanitized CS.ini.
Priority=DefaultGateway, ByLaptopType, ByDesktopType, Default
Properties=OULocation, MyCustomProperty, NameByType, NameByLocation, DeviceType