CustomSettings.ini & MachineObjectOU

I am already setting TimeZoneName, Locales, ComputerLocationName based on Default Gateway and also determining ComputerTypeName with subsections i.e.:

[ByLaptop]
Subsection=Laptop-%IsLaptop%
ComputerTypeName=LAP

[ByDesktop]
xxxxxx

etc and then determining OSDComputerName based on ComputerLocationName ComputerTypeName and SerialNumber

However, I also need to provide MachineObjectOU based on the Gateway... Here is a sample Section:

[DefaultGateway]
10.0.0.1=London

[LONDON]
TimeZoneName=GMT Standard Time
UserLocale=en-GB
SystemLocale=en-GB
KeyboardLocale=0809:00000809
ComputerLocationName=LON

How do I then tell it to add a Laptop to a specific London Laptop OU and Desktop to a London Desktop OU and then carry on for all 120 locations?

I'm guessing subsection, but unsure how to call %IsLaptop% again?!


November 7th, 2013 5:05pm

Here is what I do (to give you an idea) with my customsetting.ini file. I've left out the [Default] section. I have an entry for each piece of hardware we support. I've just added an example laptop, desktop and VMWare platform for an example. I've also replaced our site code with your London example.

Variable Model and SerialNumber are task sequence variables that are available to use. Thus they are not new values and are not on the Properties list.

[Settings]
Priority=Default,ByModel,DefaultGateway,SetMacSettings
Properties=SiteCode,tSerialNum,OUContainer,OUSite,PCPrefix

[SetMacSettings]
OSDComputerName=%PCPrefix%%SiteCode%%tSerialNum%
MachineObjectOU=LDAP://%OUContainer%,%OUSite%,DC=contoso,DC=com

[ByModel]
Subsection=%Model%

[Latitude E7440]
OSInstall=Y
PCPrefix=L
OUContainer=OU=Laptop,OU=Machines
tSerialNum=#Right("%SerialNumber%",7)#

[OptiPlex 9020]
OSInstall=Y
PCPrefix=D
OUContainer=OU=Desktop,OU=Machines
tSerialNum=#Right("%SerialNumber%",7)#

[VMWare Virtual Platform]
OSInstall=Y
PCPrefix=V
OUContainer=OU=Virtual,OU=Machines
tSerialNum=#Right(Replace(Replace(oEnvironment.Item("SerialNumber")," ",""),"-",""),7)#

[LONDON]
SiteCode=LON
OUSite=OU=London
TimeZoneName=GMT Standard Time

[DefaultGateway]
10.0.0.1=LONDON

So, with this example a Latitude E7440 laptop with serial number 1234567 on the 10.0.0.1 network would image as follows:

1. Process [Default] section (not included here)
2. Process [Bymodel] section    
    a. Model variable will equal Latitude E7440 and execute that subsection
    b. OSInstall=Y (allows image to proceed)
    c. PCPrefix=L (For Laptop)
    d. OUContainer=OU=Laptop,OU=Machines (This starts to build the string that tells were to place the machine when it joins the domain)
    d. tSerialNum=The several characters starting from the right of the machines serial number
3. Process [DefaultGateway]    section
    a. Match up to the 10.0.0.1 gateway and execute the [LONDON] section
4. Process [LONDON] section
    a. SiteCode=LON (We use a sitecode for our systems as part of their name)
    b. OUSite=OU=London (This would determine the location part of your OU string)
    c. TimeZoneName=GMT Standard Time (Sets your timezone...)
5. Process [SetMacSettings] section (This is where I combine everything from before.)
    a. OSDComputerName=LLON1234567
    b. MachineObjectOU=LDAP://OU=Laptop,OU=Machines,OU=London,DC=contoso,DC=com (DC will differ for your environment)
        i. If you did a desktop, it would have ended up as LDAP://OU=Desktop,OU=Machines,OU=London,DC=contoso,DC=com

I hope this example helps. Let me know if something isn't clear.


  • Edited by James Ihde Friday, November 08, 2013 4:21 AM clarification
  • Marked as answer by Peter Cashen Friday, November 08, 2013 8:18 AM
Free Windows Admin Tool Kit Click here and download it now
November 8th, 2013 7:18am

Hi James - I'm trying to something similar but I use SCCM 2012 with the Admin database. There are three locations but I need to sub-divide the machineobjectOU into laptop/desktop

So if I set machineobjectOU in the admindatabase as the container I need to add container bit like you have i.e. OU=DESKTOP,OU=MACHINES or OU=LAPTOP,OU=MACHINES

Can I set something in customsettings.ini such as machineobjectou = machineobjectou,%oucontainer% ?

February 16th, 2014 9:02am

Ian,

I'm not overly familiar with the Admin database and how you can name variables in there, but I know that at least in the customsettings.ini file that once you set a variable that is it. No amount of trying to set another value to it in the customsettings.ini file will work. More or less it is like the variable becomes read only (in the customsettings.ini file). You can still manipulate the variable with a Set TaskSequence Variable step in your OSD Task Sequence.

So, I assume you could have the MachineObjectOU variable set in the Admin database and pull that in to your task sequence. Then you could do a set Task Sequence variable on device type to modify the OU. Something like this:

Set Task Sequence Variable (if %IsDesktop% = True)
MachineObjectOU = OU=Desktop,OU=Machines,%MachineObjectOU%

Set Task Sequence Variable (if %IsLaptop% = True)
MachineObjectOU = OU=Laptop,OU=Machines,%MachineObjectOU%

What you will need to look out for or account for is how to properly build the string such that LDAP:// is on the front of it. Should be easy enough to do.

Free Windows Admin Tool Kit Click here and download it now
February 16th, 2014 11:05am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics