Exemple : MDT avec SQL Dans mon lab, j'ai déployé un MDT avec DFS pour les applications. Voici l'exemple complet : Fichier customsettings.ini [Settings] Priority=DefaultGateway, TaskSequenceID, Default, MAKE, CSettings Properties=TargetGroup [Default] OSInstall=Y ;Computer Details SkipComputerName=YES SkipDomainMembership=YES JoinDomain=ad.khroners.fr DomainAdmin=mdt_admin DomainAdminDomain=ad.khroners.fr DomainAdminPassword=Motdepasse ;Skip Task Sequence SkipTaskSequence=NO ;TaskSequenceID=W10PRO-21H2-X64 ;Drivers DriverGroup001=WinPE x64\%Make% ;WSUS TargetGroup=MDT ;User Data SkipUserData=YES ;Computer Backup SkipComputerBackup=YES ;Product Key SkipProductKey=YES ;Language Packs SkipPackageDisplay=YES ;Locale and Time SkipLocaleSelection=YES SkipTimeZone=YES KeyboardLocale=040c:0000040c KeyboardLocalePE=040c:0000040c UserLocale=fr-FR UILanguage=fr-FR TimeZoneName=Romance Standard Time ;Roles and Features SkipRoles=YES ;Applications SkipApplications=YES ;Administrator Password SkipAdminPassword=YES AdminPassword=local-admin-password ;Local Administrators SkipAdminAccounts=YES ;Capture Image SkipCapture=YES ;Bitlocker SkipBitLocker=YES ;Ready to begin SkipSummary=YES ;Operating system deployment completed successfully SkipFinalSummary=YES FinishAction=REBOOT WSUSServer=http://RN-SRV-WS-AAD01.ad.khroners.fr:8530 EventService=http://RN-SRV-WDS01:9800 [DefaultGateway] 10.29.0.254=Brest 10.35.100.254=Rennes [Brest] SLShare=\\BR-SRV-WDS01.ad.khroners.fr\DeploymentShare$\Logs EventService=http://BR-SRV-WDS01:9800 [Rennes] SLShare=\\RN-SRV-WDS01.ad.khroners.fr\DeploymentShare$\Logs EventService=http://RN-SRV-WDS01:9800 [W10-22H2-ADM-35] MachineObjectOU=OU=Administratifs,OU=Workstations,OU=RENNES,OU=Sites,DC=ad,DC=khroners,DC=fr [W10-22H2-FOR-35] MachineObjectOU=OU=Formateurs,OU=Workstations,OU=RENNES,OU=Sites,DC=ad,DC=khroners,DC=fr [CSettings] SQLServer=RN-SRV-WDS01.ad.khroners.fr Instance=SQLEXPRESS Database=MDT Netlib=DBMSSOCN DBID=sql_mdt DBPWD=Motdepasse Table=ComputerSettings Parameters=UUID, AssetTag, SerialNumber, MacAddress ParameterCondition=OR Fichier bootstrap.ini [Settings] Priority=DefaultGateway, Default [DefaultGateway] 10.29.0.254=Brest 10.35.100.254=Rennes [Brest] DeployRoot=\\BR-SRV-WDS01\DeploymentShare$ [Rennes] DeployRoot=\\RN-SRV-WDS01\DeploymentShare$ [Default] UserDomain=AD UserID=mdt_admin UserPassword=Motdepasse SkipBDDWelcome=YES Scripts DeployWiz_SelectTS.vbs J'ai modifié ce script pour utiliser la property "TaskSequenceID" dans le customsettings.ini. ' // *************************************************************************** ' // ' // Copyright (c) Microsoft Corporation. All rights reserved. ' // ' // Microsoft Deployment Toolkit Solution Accelerator ' // ' // File: DeployWiz_Initialization.vbs ' // ' // Version: 6.3.8456.1000 ' // ' // Purpose: Main Client Deployment Wizard Initialization routines ' // ' // *************************************************************************** Option Explicit ''''''''''''''''''''''''''''''''''''' ' Image List ' Dim g_AllOperatingSystems Function AllOperatingSystems Dim oOSes If isempty(g_AllOperatingSystems) then set oOSes = new ConfigFile oOSes.sFileType = "OperatingSystems" oOSes.bMustSucceed = false set g_AllOperatingSystems = oOSes.FindAllItems End if set AllOperatingSystems = g_AllOperatingSystems End function Function InitializeTSList Dim oItem, sXPathOld If oEnvironment.Item("TaskSequenceID") <> "" and oProperties("TSGuid") = "" then sXPathOld = oTaskSequences.xPathFilter for each oItem in oTaskSequences.oControlFile.SelectNodes( "/*/*[ID = '" & oEnvironment.Item("TaskSequenceID")&"']") oLogging.CreateEntry "TSGuid changed via TaskSequenceID = " & oEnvironment.Item("TaskSequenceID"), LogTypeInfo oEnvironment.Item("TSGuid") = oItem.Attributes.getNamedItem("guid").value exit for next oTaskSequences.xPathFilter = sXPathOld End if TSListBox.InnerHTML = oTaskSequences.GetHTMLEx ( "Radio", "TSGuid" ) PopulateElements TSItemChange End function Function TSItemChange Dim oInput ButtonNext.Disabled = TRUE for each oInput in document.getElementsByName("TSGuid") If oInput.Checked then oLogging.CreateEntry "Found CHecked Item: " & oInput.Value, LogTypeVerbose ButtonNext.Disabled = FALSE exit function End if next End function ''''''''''''''''''''''''''''''''''''' ' Validate task sequence List ' Function ValidateTSList Dim oTS Dim sCmd 'ajoute Dim oItem Set oShell = createObject("Wscript.shell") ' set oTS = new ConfigFile oTS.sFileType = "TaskSequences" SaveAllDataElements If Property("TSGuid") = "" then oLogging.CreateEntry "No valid TSGuid found in the environment.", LogTypeWarning ValidateTSList = false End if oLogging.CreateEntry "TSGuid Found: " & Property("TSGuid"), LogTypeVerbose If oTS.FindAllItems.Exists(Property("TSGuid")) then oEnvironment.Item("TaskSequenceID") = oUtility.SelectSingleNodeString(oTS.FindAllItems.Item(Property("TSGuid")),"./ID") End if ' Set the related properties oUtility.SetTaskSequenceProperties oEnvironment.Item("TaskSequenceID") If oEnvironment.Item("OSGUID") <> "" and oEnvironment.Item("ImageProcessor") = "" then ' There was an OSGUID defined within the TS.xml file, however the GUID was not found ' within the OperatingSystems.xml file. Which is a dependency error. Block the wizard. ValidateTSList = False ButtonNext.Disabled = True Bad_OSGUID.style.display = "inline" Else ValidateTSList = True ButtonNext.Disabled = False Bad_OSGUID.style.display = "none" End if ' ajoute sCmd = "wscript.exe """ & oUtility.ScriptDir & "\ZTIGather.wsf""" oItem = oShell.Run(sCmd, , true) ' End Function ZTIWindowsUpdate.wsf J'ai modifié ce script pour ajouter la property "TargetGroup" pour cibler les PC lors du déploiement pour WSUS. Il faut donc ajouter un groupe de PC dans WSUS. Raccourcis.ps1 Ce script me permet d'ajouter des raccourcis dans le bureau public de l'ordinateur. # Raccourci Office.com avec icône Copy-Item "\\RN-SRV-WDS01.ad.khroners.fr\GPO$\Raccourcis\Office.ico" -Destination "C:\Office.ico" $TargetFile = "https://www.office.com/" $shortcutFile = "C:\Users\Public\Desktop\Portail Office Web.lnk" $WScriptShell = New-Object -ComObject WScript.Shell $shortcut = $WScriptShell.CreateShortcut($ShortcutFile) $shortcut.TargetPath = $TargetFile $shortcut.IconLocation = "C:\Office.ico" $shortcut.Save() # Raccourcis suite Microsoft365 Copy-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Word.lnk" -Destination "c:\users\Public\Desktop" -Force Copy-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Excel.lnk" -Destination "c:\users\Public\Desktop" -Force Copy-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\PowerPoint.lnk" -Destination "c:\users\Public\Desktop" -Force Copy-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OneNote.lnk" -Destination "c:\users\Public\Desktop" -Force Copy-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Outlook.lnk" -Destination "c:\users\Public\Desktop" -Force Copy-Item -Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Publisher.lnk" -Destination "c:\users\Public\Desktop" -Force Install_Drivers.ps1 Ce script me permet de télécharger les pilotes via Windows Update. $Session = New-Object -ComObject Microsoft.Update.Session $Searcher = $Session.CreateUpdateSearcher() $Searcher.ServiceID = '7971f918-a847-4430-9279-4a52d1efe18d' $Searcher.SearchScope = 1 # MachineOnly $Searcher.ServerSelection = 3 # Third Party $Criteria = "IsInstalled=0 and Type='Driver'" Write-Host('Searching Driver-Updates...') -Fore Green $SearchResult = $Searcher.Search($Criteria) $Updates = $SearchResult.Updates #Show available Drivers... $Updates | select Title, DriverModel, DriverVerDate, Driverclass, DriverManufacturer | fl $UpdatesToDownload = New-Object -Com Microsoft.Update.UpdateColl $updates | % { $UpdatesToDownload.Add($_) | out-null } Write-Host('Downloading Drivers...') -Fore Green $UpdateSession = New-Object -Com Microsoft.Update.Session $Downloader = $UpdateSession.CreateUpdateDownloader() $Downloader.Updates = $UpdatesToDownload $Downloader.Download() $UpdatesToInstall = New-Object -Com Microsoft.Update.UpdateColl $updates | % { if($_.IsDownloaded) { $UpdatesToInstall.Add($_) | out-null } } Write-Host('Installing Drivers...') -Fore Green $Installer = $UpdateSession.CreateUpdateInstaller() $Installer.Updates = $UpdatesToInstall $InstallationResult = $Installer.Install() if($InstallationResult.RebootRequired) { Write-Host('Reboot required! please reboot now..') -Fore Red } else { Write-Host('Done..') -Fore Green } $updateSvc.Services | ? { $_.IsDefaultAUService -eq $false -and $_.ServiceID -eq "7971f918-a847-4430-9279-4a52d1efe18d" } | % { $UpdateSvc.RemoveService($_.ServiceID) } RestoreREG.ps1 Ce script permet de restaurer le registre suite à ma modification de ce dernier avant le déploiement : Modifier le registre d... | Docs Khroners reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching /v SearchOrderConfig /t REG_DWORD /d 00000001 /f reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate /f Applications Liste Bundle pour installer toutes les applications Exemple de commande d'installation MSI msiexec /I \\ad.khroners.fr\SI$\GPO\Chrome\googlechromestandaloneenterprise64.msi /qn Si le répertoire où est placé le setup est sur un partage DFS (ou simplement en dehors du DeploymentShare (à vérifier)), il faut qu'une des applications du bundle comprenne le partage dans le champ "Working Directory". EXE \\ad.khroners.fr\SI$\GPO\Bitwarden\Bitwarden-Installer-2022.10.1.exe /S /ALLUSERS