Jump to content

MDT powershell

tom3297

Hi everyone,

 

Im busy trying to import assets into a database with powershell.

The script look like its working but doesen't import all the data i need.

Anyone who has expirience with this script?

Or maybe has some tips?

 

import-Module –name D:\MDTDB.psm1
Connect-MDTDatabase –sqlServer SRV-MDT-01 –instance SQLEXPRESS –database MDT
$machines = Import-Csv D:\mdtimport.csv
For($i=1; $i -le $machines.count; $i++)
{
New-MDTComputer -AssetTag $machines[$i-1].Name -Description $machines[$i-1].Name -SerialNumber $machines[$i-1].UUID -settings @{
OSInstall='YES';OSDComputerName=$machines[$i-1].Name
}
}

{
$PCNAME=$machines[$i-1].Name
write-host Updating $machines[$i-1].Name
get-mdtcomputer -assetTag $machines[$i-1].Name | Set-MDTComputerRole -roles @('Laptop - Gemert - Bakel')
}
}

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×