Menu
CCMEXEC.COM – Enterprise Mobility
  • Home
  • General
  • Configuration Manager
  • Windows 10
  • Intune
  • GitHub
  • Windows 11
  • About the author
CCMEXEC.COM – Enterprise Mobility

Import Computers into MDT

Posted on October 6, 2010 by Jörgen Nilsson

When migrating from SMS2003 or another deployment solution to SCCM 2007/MDT, one of the challenges are to import the computers into the MDT database so they are present when a computer needs to be re-installation is necessary. Michael Niehaus have written a great article and powershell cmdlet which I have used a couple of times now and it works great, you can download it here at Michael Niehaus blogg.
This is an example of how to do it:

  1. Create a report in the new SCCM environment which contains the clients which needs importing into the MDT database, with name and UUID.
  2. Export it to a CSV file
  3. Remove all entries with blank if any UUID.
  4. Add roles to be imported for the computers in the CSV file, for instance roles used during deployment perhaps OS version. In this example two columns for roles as displayed in the example below:

Name,UUID,Role1,Role2
Client1,9B927E08-E490-4B78-9AD4-D38E4ACBF19C,”Windows7″,”HR”
Client2,81DFEB96-4880-41C6-8310-C09AC8039772,”WindowsXP”

  1. Then import the CSV file using powershell script
  2. The powershellscript in this example will do the following:
    1. Import the computer and UUID, if the UUID doesn’t already exist in the MDT database
    2. Add the roles to the imported object.

As always test the script in a test-environment before using it in production!:

Import-Module –name C:\MDTDB.psm1

Connect-MDTDatabase –sqlServer SCCM1 –database Deployment

$machines = Import-Csv C:\mdtimport.CSV

 

For ($i=1; $i -le $machines.count; $i++)

{

$machineid = get-mdtcomputer -uuid $machines[$i-1].uuid

if ($machineid -eq $NULL)
{
“New machine”
   New-MDTComputer -uuid $machines[$i-1].uuid -description $machines[$i-1].name -settings @{
      OSDComputerName=$machines[$i-1].name;
      OSInstall=’YES’;
      Computername=$machines[$i-1].name}

   $machineid = get-mdtcomputer -uuid $machines[$i-1].uuid
   set-mdtcomputerrole $machineid.id $machines[$i-1].role1 , $machines[$i-1].role2
}

}

 

Then you are ready to install computers using your new SCCM+MDT environment.

 

 

 

 

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

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

My name is Jörgen Nilsson and I work as a Senior Consultant at Onevinn in Malmö, Sweden. This is my blog where I will share tips and stuff for my own and everyone elses use on Enterprise Mobility and Windows related topics.
All code is provided "AS-IS" with no warranties.

Recent Posts

  • PowerShell script to keep Personal Teams away in Windows 11
  • Windows 11 Multi-App kiosk – a first look
  • Playing around with Driver Updates in Intune
  • MMUGSE – Summer Meetup 8th of June 2023
  • PS Script to Update Boot images with CU-CVE-2023-24932

©2023 CCMEXEC.COM – Enterprise Mobility | WordPress Theme by Superb Themes
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Reject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT