Close Menu
    Facebook X (Twitter) Instagram
    Trending
    • Workplace Ninja User Group Denmark – April 2026 Meetup
    • Workplace Ninja User Group Denmark March 2026 Meetup
    • Workplace Ninja User Group Denmark February 2026 Meetup
    • Successful Adoption of a “Cloud First” Strategy
    • Speaking at Nordic Virtual Summit
    • Workplace Ninja User Group Denmark February Meetup
    • Workplace Ninja User Group Denmark Meetup – May 2022
    • Workplace Ninja User Group Denmark Meetup – April 2022
    RONNIPEDERSEN.COM
    • Home
    • Enterprise Mobility
      • Configuration Manager
      • Identity and Access
      • Information Protection
      • Intune
    • Cloud and Data Center
      • Data Center Management
      • Group Policy
      • Enterprise Security
      • Hyper-V
      • PowerShell
    • Guides
    • Webcasts
    • Links
    • About
      • Contact me
      • Disclaimer
    RONNIPEDERSEN.COM
    You are at:Home»Enterprise Mobility»Configuration Manager»Setting OSDComputerName using CustomSettings.ini

    Setting OSDComputerName using CustomSettings.ini

    16
    By Ronni Pedersen on October 27, 2014 Configuration Manager, Enterprise Mobility, Windows and Devices, Windows Deployment

    Last week I got a call from a customer, that wanted to automate the naming of new computers, that was beeing deployed using System Center Configuration Manager. They were using the build-in UDI Wizard, that comes with the Microsoft Deployment Toolkit (MDT).

    But the default computer name for new computers are “MININT-%SomeRandomNumber%”.

    image

    They want to use the following naming standard:

    • The first 3 characters should be static (The company prefix). In this example well use “ABC”.
    • The next character should be the Device type (D=Desktop, L=Laptop or V=Virtual Machine).
    • The last (up to) 9 characters should be the computer’s serial number

    Example: ABC-V-A4G75GYL1

    This kind of requirement something that almost every customers has, so it was pretty easy for me to provide the solution. But from time to time I get questions about this, so I thought I’d share the solution here.

    Here is the CustomSettings.ini file that we used to solve this requirement:

    [Settings]
    Priority=Init, ByDesktop, ByLaptop, ByVirtual, Default
    Properties=MyCustomProperty,ComputerSerialNumber, ComputerTypeName

    [Init]
    ComputerSerialNumber=#Right(“%SerialNumber%”,9)#

    [ByLaptop]
    Subsection=Laptop-%IsLaptop%

    [ByDesktop]
    Subsection=Desktop-%IsDesktop%

    [ByVirtual]
    Subsection=Virtual-%IsVM%

    [Laptop-True]
    ComputerTypeName=L

    [Desktop-True]
    ComputerTypeName=D

    [Virtual-True]
    ComputerTypeName=V

    [Default]
    OSDComputerName=DNK-%ComputerTypeName%-%ComputerSerialNumber%

    After updating the CustomSettings.ini file and the updated the Distribution Point’s, this was the new default behavior:

    image

    That’s it…

    Enjoy.

    +Ronni Pedersen

    • Tweet
    • Share 0
    • +1
    • LinkedIn 0

    Related

    Ronni Pedersen
    • Website
    • Facebook
    • X (Twitter)
    • LinkedIn

    My name is Ronni Pedersen and I'm currently working as a Cloud Architect at APENTO in Denmark. My primary focus is Enterprise Client Management solutions, based on technologies like AzureAD, Intune, EMS and System Center Configuration Manager. I'm is also a Microsoft Certified Trainer and Microsoft MVP in Enterprise Mobility.

    Related Posts

    Speaking at Nordic Virtual Summit

    Workplace Ninja User Group Denmark February Meetup

    Speaking at Modern Endpoint Management Summit 2022

    16 Comments

    1. ayo dada on January 15, 2015 23:13

      why have you got DNK is that not meant to be ABC

      [Default]
      OSDComputerName=DNK-%ComputerTypeName%-%ComputerSerialNumber%

      Reply
      • Ronni Pedersen on February 3, 2015 01:29

        A “bug” in the screenshot 🙂

        Reply
    2. Jason on February 4, 2015 23:04

      Great information– thanks for the share! I was wondering if you could help by providing some basic directions as to where to put the CustomSettings.ini file to replace the MININT naming scheme? Also, in this case your customer used a static prefix to represent the company name. In my environment, we use dynamic prefixes based on the division, but otherwise our naming convention is exactly the same. I was hoping you wouldn’t mind helping me to modify the settings so that I can allow modification of the prefix– for example we use TEC for technology division, CCC for our Call Center, etc. I made an initial attempt which I could provide but I’d like to have some confirmation that it’s done properly before making any changes to our configuration. Anyways thanks again for your contribution and please continue the good work!

      Reply
      • Ronni Pedersen on March 2, 2015 17:31

        The CustomSettings.ini file is generated automatically when you create a new MDT Task Sequence.
        It simply just a text file in a folder (Package).
        You can specify dynamic names by using “roles” with the MDT database. You need something to tell what role a computer should be a member of.

        Reply
    3. Mohammed Shariff on October 2, 2016 22:19

      Hello thr,
      Please help with below requirement.
      If Desktop assign SYS prefix and four digits number example SYS0001
      If Lapto assign LAP prefix and four digits number example LAP0001 and if computer name is already available in AD then assign SYS002 / LAP002 based on device type laptop r desktop.

      Reply
    4. Roy on November 15, 2017 12:33

      Hi, this is a great post, the other ones don’t specify using a portion of the serial number.

      With the Surface Pro 4/5’s however, the latter part of the serial number is not unique. Therefore i need to take the beginning characters from the serial to append to OSDCOmputerName.

      So far, i have this: OSDComputerName=SURF#LEFT(“%SerialNumber%”,5)#

      Not tested yet, let me know if you think this looks right? hope this helps anyone else too.

      Reply
      • Ronni Pedersen on November 21, 2017 00:09

        Should be fine!

        Reply
      • Nick Damman on July 1, 2019 18:29

        With the Surface Laptop 2 the first 4 characters are the same and the last 4 characters are the same. I need a script that picks out the middle 4 numbers. Any ideas?

        Reply
    5. Soner on August 21, 2018 09:55

      Hi Ronni, great post! Similar to Roy our naming convention is the first 5 characters from the serial,then the letter ‘A’ followed by the current month and year: example – A1B23A0818. Is it possible to automate that?

      Soner

      Reply
      • Ronni Pedersen on August 21, 2018 10:25

        Never tried, but I would say yes (without having tried).
        All you need the VBScript code to get the month and year.

        Reply
    6. Santhosh Kumar S on October 26, 2018 16:07

      Hi Ronni, We have got the naming convention like Domain-Serialnumber-ChasesType. Do you have CS.ini settings for this naming convention ?

      Reply
      • Ronni Pedersen on November 18, 2018 14:44

        No. But it can be done…

        Reply
    7. pushkar Singh on August 1, 2019 17:38

      Hi Ronni, Thanks for sharing it’s really knowledgeable. We are using the same method for assigning the machine name however we have a model and it’s chassis type is 33 and being detected as a Desktop however it’s a laptop. Do we have nay scripts where I can exclusively define it.

      Reply
    8. Shri S Muthulingam on January 30, 2020 04:37

      Hi
      I need some help in getting the Task Sequence ID to work with OSDComputerName. For example TS=1 will have Computername=XXX-1222333abc and Ts=2 will have Computername=YYY-1565656RES
      Can this be done in Customsetting ini file?
      Please advise.

      Reply
    9. TJ Scott on September 16, 2022 01:52

      I have the full computername in the MDT database. But can’t seem to retrieve it using the customsettings.ini file. We’re using the most recent version of MDT, 8456. Tried using this: OSDComputerName=%OSDComputerName%. Placed it in the Csettings section and then in the default section. Neither worked; MDT froze up when it tried to process those lines. Can you shed any light on what I’m doing wrong?

      Reply
    10. unkown on November 8, 2022 13:02

      thanks for sharing how to use The first 3 characters as dynamic based on default gateway and how to add regional settings, joining to specific OU in custom settings.ini based default gateway

      second question how to use customsetting.ini in custom task sequence looking sample NON MDT DEFAULT TASK SEQUENCE

      Reply
    Leave A Reply Cancel Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Follow
    APENTO

    Follow APENTO here:

    Subscribe to Blog via Email

    Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    About
    My name i s Ronni Pedersen and I'm currently working as a Cloud Architect at APENTO in Denmark. My primary focus is Endpoint Management and Security, based on Microsoft technologies. I'm also a Microsoft Certified Trainer and a dual Microsoft MVP in both Security and Windows.
    Recent Posts
    • Workplace Ninja User Group Denmark – April 2026 Meetup
    • Workplace Ninja User Group Denmark March 2026 Meetup
    • Workplace Ninja User Group Denmark February 2026 Meetup
    • Successful Adoption of a “Cloud First” Strategy
    • Speaking at Nordic Virtual Summit
    Archives
    TOP POSTS
    • SCCM 2012 R2: Where is the SMSTS.log located?
    • Missing “UserType” attribute in Azure AD
    • Find the TimeZoneName for your SCCM/MDT Deployments
    • Windows Vista Pre-Build VHD available for download
    • HOW-TO: Sequence applications using App-V 5 for SCCM 2012
    RECENT COMMENTS
    • cOSHi on Missing “UserType” attribute in Azure AD
    • Gus on Pro Tip: Use Ctrl+Alt+D from the Azure Portal to get performance information
    • Sebi on Prepare for Co-Management: Migrate Intune Devices without user affinity
    • Vadim P on SCCM: Failed to Get Client Identity (80004005)
    • TM on Active Directory Based Activation in an multi domain environment
    DISCLAIMER
    The content on this website is presented "as-is" with no guarantees. The use of scripts from this website is at your own risk. Always test before putting something in production! Opinions expressed are my own.
    © 2026 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.