├── Import-OSBuild.ps1 ├── LICENSE └── README.md /Import-OSBuild.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | =========================================================================== 4 | Created on: 1/10/2019 5 | Author: Andrew Jimenez (asjimene) - https://github.com/asjimene/ 6 | Filename: Import-OSBuild.ps1 7 | Version: 2020.02.19 8 | =========================================================================== 9 | .SYNOPSIS 10 | Imports Image File Builds created using the OSDBuilder tool by David Segura (http://www.osdbuilder.com) 11 | 12 | .DESCRIPTION 13 | ## OSDBuilder Import Tool 14 | The purpose of this tool is to import OSBuilds and OSMedia created using David Segura's OSDBuilder module into SCCM. It's primary functions are as follows: 15 | 1. Copy the OSBuild/OSMedia into the correct content shares (wim file and optionally OS Upgrade Packages) 16 | 2. Import the OSBuild/OSMedia into SCCM Operating System Images (Optionally import OS Upgrade Package) 17 | 3. Distribute Content to a specified Distribution Point Group 18 | 4. Optionally update a specified task sequence step with the new OS Image 19 | 20 | .EXAMPLE 21 | .\Import-OSBuild.ps1 22 | Imports an OSBuild wim file only 23 | 24 | .EXAMPLE 25 | .\Import-OSBuild.ps1 -ImportOSUpgrade 26 | Import an OSBuild wim file and the cooresponding OS Upgrade Package 27 | 28 | .EXAMPLE 29 | .\Import-OSBuild.ps1 -OSUploadName "Windows 10 Enterprise x64 1809" -ImportOSUpgrade 30 | Import the latest OSBuild with the name like "Windows 10 Enterprise x64 1809", and import the cooresponding OSUpgrade package. This flag is helpful for automating the upload process, say... after an OSBuild is completed. 31 | 32 | .EXAMPLE 33 | .\Import-OSBuild.ps1 -OSUploadMedia -OSUploadName "Windows 10 Enterprise x64 1809" -UpdateTS -TaskSequenceName "DEV Task Sequence" -TaskSequenceStepName "Install Windows 10 x64" 34 | Import the latest OSMedia with the name like "Windows 10 Enterprise x64 1809", then update the step "Install Windows 10 x64" in the task sequence "DEV Task Sequence" with the newly uploaded media 35 | 36 | .EXAMPLE 37 | .\Import-OSBuild -Import-OSMedia -ImportOSUpgrade 38 | Import an OSMedia wim file and the cooresponding OS Upgrade Package 39 | 40 | .EXAMPLE 41 | .\Import-OSBuild -UseExistingPackages 42 | Import an OSBuild, but do not create a new wim on the content share, instead update an exising wim 43 | NOTE: This flag cannot be used silently 44 | 45 | .EXAMPLE 46 | .\Import-OSBuild -UseExistingPackages -ImportOSUpgrade 47 | Import an OSBuild wim file, and the cooresponding OS Upgrade Package but use an exising wim and Upgrade Package 48 | 49 | #> 50 | 51 | param ( 52 | # Also import the associated OSUpgrade package 53 | [Parameter(Mandatory = $false)] 54 | [switch]$ImportOSUpgrade = $false, 55 | 56 | # Import OSMedia instead of OSBuild 57 | [Parameter(Mandatory = $false)] 58 | [switch]$ImportOSMedia = $false, 59 | 60 | # Upgrade an existing Image and (optionally) Upgrade Package 61 | [Parameter(Mandatory = $false)] 62 | [switch]$UseExistingPackages = $false, 63 | 64 | # Build/Media Name to upload (Uses '-like "*$OSUploadName*"' to choose the latest OSBuild or OSMedia with the provided name) 65 | [Parameter(Mandatory = $false)] 66 | [string]$OSUploadName, 67 | 68 | # Update an Operating System image in a task sequence with the newly uploaded Operating System 69 | [Parameter(ParameterSetName = 'TSUpdate', Mandatory = $false)] 70 | [switch]$UpdateTS = $false, 71 | 72 | # Specify the Name of the Task Sequence to Update (Requires UpdateTS switch) 73 | [Parameter(ParameterSetName = 'TSUpdate', Mandatory = $true)] 74 | [string]$TaskSequenceName, 75 | 76 | # Specify the Name of the Operating System Step to Update (Requires UpdateTS switch) 77 | [Parameter(ParameterSetName = 'TSUpdate', Mandatory = $true)] 78 | [string]$TaskSequenceStepName 79 | ) 80 | 81 | 82 | ## Global Variables 83 | 84 | # SCCM Variables 85 | $Global:ContentShare = "\\Path\to\Content\share" 86 | $Global:OSUpgradeContentShare = "\\Path\to\OSUpgrades\share" 87 | $Global:SCCMSite = "SITE:" 88 | $Global:PreferredDistributionLoc = "PreferredGroupName" #Must be a distribution point group at this time 89 | 90 | # Logging Variables 91 | $Global:LogPath = "$PSScriptRoot\OSDBuilder-Import.log" 92 | $Global:MaxLogSize = 1000kb 93 | 94 | # Other Variables 95 | $Global:rCpyThreads = 4 # Number of threads for Robocopy to use during OSUpgrade Copy 96 | 97 | ## Functions 98 | 99 | function Add-LogContent { 100 | param 101 | ( 102 | [parameter(Mandatory = $false)] 103 | [switch]$Load, 104 | [parameter(Mandatory = $true)] 105 | $Content 106 | ) 107 | if ($Load) { 108 | if ((Get-Item $LogPath -ErrorAction SilentlyContinue).length -gt $MaxLogSize) { 109 | Write-Output "$(Get-Date -Format G) - $Content" > $LogPath 110 | } 111 | else { 112 | Write-Output "$(Get-Date -Format G) - $Content" >> $LogPath 113 | } 114 | } 115 | else { 116 | Write-Output "$(Get-Date -Format G) - $Content" >> $LogPath 117 | } 118 | } 119 | 120 | function copy-OSDBuilderObject { 121 | param ( 122 | [ValidateSet('Image','UpgradePackage')][string]$Type, 123 | [string]$name, 124 | [string]$source, 125 | [string]$destination 126 | ) 127 | If ($Type -eq "Image"){ 128 | # Copy the selected install.wim to the ContentShare using the build name 129 | Add-LogContent "Attempting to Copy $source to $destination" 130 | try { 131 | Copy-Item -Path $source -Destination $destination -Force 132 | Add-LogContent "Copy Completed Successfully" 133 | } 134 | catch { 135 | $ErrorMessage = $_.Exception.Message 136 | Add-LogContent "ERROR: Copying $source to $destination failed! Skipping import for $name" 137 | Add-LogContent "ERROR: $ErrorMessage" 138 | } 139 | } 140 | Else { 141 | # Copy the selected Upgrade Package to the ContentShare using the build name 142 | Add-LogContent "Attempting to Copy OS Upgrade Files from $source to $destination" 143 | 144 | try { 145 | #Copy-Item -Path "$($source)\OS" -Destination "$destination" -Recurse -Force 146 | 147 | $rcpyArguments = "`"$source`" `"$destination`" /MIR /Z /MT:$Global:rCpyThreads" 148 | Add-LogContent "Copy Command: robocopy.exe $rcpyArguments" 149 | 150 | Start-Process "robocopy.exe" -ArgumentList $rcpyArguments -Wait -NoNewWindow 151 | Add-LogContent "Copy Completed Successfully" 152 | } 153 | catch { 154 | $ErrorMessage = $_.Exception.Message 155 | Add-LogContent "ERROR: Copying $source to $destination failed! Skipping import for $name" 156 | Add-LogContent "ERROR: $ErrorMessage" 157 | } 158 | } 159 | } 160 | 161 | function import-OSDBuilderObject { 162 | param ( 163 | [ValidateSet('Image','UpgradePackage')][string]$Type, 164 | [string]$Name, 165 | [string]$Path, 166 | [string]$version, 167 | [string]$Description 168 | ) 169 | 170 | # Import the Copied wim into SCCM 171 | Add-LogContent "Importing $Name" 172 | Push-Location 173 | Set-Location $Global:SCCMSite 174 | try { 175 | if ($Type -eq "Image"){ 176 | New-CMOperatingSystemImage -Name "$Name" -Path "$Path" -Version "$version" -Description "$Description" 177 | Add-LogContent "Successfully Imported the Operating System as $Name" 178 | } 179 | Else { 180 | New-CMOperatingSystemInstaller -Name "$Name" -Path "$Path" -Version "$version" -Description "$Description" 181 | Add-LogContent "Successfully Imported the Operating System as $Name" 182 | } 183 | } 184 | catch { 185 | $ErrorMessage = $_.Exception.Message 186 | Add-LogContent "ERROR: Importing wim into SCCM from $Path failed! Skipping import for $Name" 187 | Add-LogContent "ERROR: $ErrorMessage" 188 | } 189 | Pop-Location 190 | } 191 | 192 | function Update-OSContent { 193 | param ( 194 | [ValidateSet('Image','UpgradePackage')][string]$Type, 195 | [string]$Name 196 | ) 197 | 198 | # Distribute the new OSImage to the Specified Distribution Point Group 199 | Add-LogContent "Distributing $Name to $($Global:PreferredDistributionLoc)" 200 | Push-Location 201 | Set-Location $Global:SCCMSite 202 | if ($updateExistingImage){ 203 | try { 204 | if ($Type -eq "Image"){ 205 | Invoke-CMContentRedistribution -InputObject $(Get-CMOperatingSystemImage -Name "$Name") -DistributionPointGroupName $Global:PreferredDistributionLoc 206 | (Get-CMOperatingSystemImage -Name "$Name").ExecuteMethod("ReloadImageProperties", $null) 207 | Add-LogContent "Successfully Completed Copy, and Re-Distribution of OSBuild: $Name" 208 | } 209 | else { 210 | Invoke-CMContentRedistribution -InputObject $(Get-CMOperatingSystemInstaller -Name "$Name") -DistributionPointGroupName $Global:PreferredDistributionLoc 211 | Add-LogContent "Successfully Completed Copy, and Re-Distribution of OSUpgrade: $Name" 212 | } 213 | } 214 | catch { 215 | $ErrorMessage = $_.Exception.Message 216 | Add-LogContent "ERROR: Distributing OSImage $Name Failed!" 217 | Add-LogContent "ERROR: $ErrorMessage" 218 | } 219 | } 220 | else { 221 | try { 222 | if ($Type -eq "Image"){ 223 | Start-CMContentDistribution -OperatingSystemImageName "$Name" -DistributionPointGroupName $Global:PreferredDistributionLoc 224 | (Get-CMOperatingSystemImage -Name "$Name").ExecuteMethod("ReloadImageProperties", $null) 225 | Add-LogContent "Successfully Completed Copy, Import, and Distribution of OSBuild: $Name" 226 | } 227 | else { 228 | Start-CMContentDistribution -OperatingSystemInstallerName "$Name" -DistributionPointGroupName $Global:PreferredDistributionLoc 229 | Add-LogContent "Successfully Completed Copy, Import, and Distribution of OSUpgrade: $Name" 230 | } 231 | } 232 | catch { 233 | $ErrorMessage = $_.Exception.Message 234 | Add-LogContent "ERROR: Distributing OSImage $Name Failed!" 235 | Add-LogContent "ERROR: $ErrorMessage" 236 | } 237 | } 238 | Pop-Location 239 | } 240 | 241 | ## Main 242 | 243 | Add-LogContent -Content "Starting Import-OSBuild" -Load 244 | 245 | # Import ConfigurationManager Cmdlets 246 | if (-not (Get-Module ConfigurationManager)) { 247 | try { 248 | Add-LogContent "Importing ConfigurationManager Module" 249 | Import-Module (Join-Path $(Split-Path $env:SMS_ADMIN_UI_PATH) ConfigurationManager.psd1) -ErrorAction SilentlyContinue -WarningAction SilentlyContinue 250 | } 251 | catch { 252 | $ErrorMessage = $_.Exception.Message 253 | Add-LogContent "ERROR: Importing ConfigurationManager Module Failed! Exiting!" 254 | Add-LogContent "ERROR: $ErrorMessage" 255 | Exit 256 | } 257 | } 258 | 259 | # Import OSDBuilder Module Cmdlets 260 | if (-not (Get-Module OSDBuilder)) { 261 | try { 262 | Add-LogContent "Importing OSDBuilder Module" 263 | Import-Module OSDBuilder 264 | } 265 | catch { 266 | $ErrorMessage = $_.Exception.Message 267 | Add-LogContent "ERROR: Importing OSDBuilder Module Failed! Exiting!" 268 | Add-LogContent "ERROR: $ErrorMessage" 269 | Exit 270 | } 271 | } 272 | 273 | # Check OSDBuilder Version 274 | if ((Get-Module OSDBuilder).Version -lt "19.6.3.0") { 275 | Write-Host "OSDBuilder Version is out-of-date, please upgrade to the latest version" 276 | Add-LogContent "OSDBuilder Version is out-of-date, please upgrade to the latest version" 277 | Exit 278 | } 279 | 280 | # Search the OSDBuilder Path for new Wim Files to import, loop if none are selected 281 | $selectedBuilds = $null 282 | while ([System.String]::IsNullOrEmpty($selectedBuilds)) { 283 | if ($ImportOSMedia) { 284 | if ([System.String]::IsNullOrEmpty($OSUploadName)) { 285 | $selectedBuilds = Get-OSMedia -GridView 286 | } 287 | else { 288 | $selectedBuilds = Get-OSMedia | Where-Object -Property Name -like "$OSUploadName*" | Sort-Object ModifiedTime | Select-Object -Last 1 289 | } 290 | Add-LogContent "Selected the Following Media to import: $($SelectedBuilds.Name -join " ; ")" 291 | } 292 | Else { 293 | if ([System.String]::IsNullOrEmpty($OSUploadName)) { 294 | $selectedBuilds = Get-OSBuilds -GridView 295 | } 296 | else { 297 | $selectedBuilds = Get-OSBuilds | Where-Object -Property Name -like "$OSUploadName*" | Sort-Object ModifiedTime | Select-Object -Last 1 298 | } 299 | Add-LogContent "Selected the Following Builds to import: $($SelectedBuilds.Name -join " ; ")" 300 | } 301 | } 302 | 303 | if ($UseExistingPackages){ 304 | # Get the OSImage name and the OSUpgradePackage name from SCCM 305 | Push-Location 306 | Set-Location $Global:SCCMSite 307 | $OSImageSelection = Get-CMOperatingSystemImage | Select-Object Name,ImageOSVersion,SourceDate,PkgSourcePath | Out-GridView -Title "Select the OS Image to Upgrade" -OutputMode Single 308 | $Global:ContentShare = $OSImageSelection.PkgSourcePath 309 | if ($ImportOSUpgrade) { 310 | $OSUpgradeSelection = Get-CMOperatingSystemInstaller | Select-Object Name,ImageOSVersion,SourceDate,PkgSourcePath | Out-Gridview -Title "Select the Upgrade Package to Update" -OutputMode Single 311 | $Global:OSUpgradeContentShare = $OSUpgradeSelection.PkgSourcePath 312 | } 313 | Pop-Location 314 | } 315 | 316 | ForEach ($Build in $SelectedBuilds){ 317 | # Set Build Variables 318 | $BuildName = $Build.Name 319 | $BuildVersion = $Build.UBR 320 | $BuildDescription = $Build.Imagename + " Version $BuildVersion - Imported from OSDBuilder on: $(Get-Date -Format G)" 321 | $wimLocation = Join-Path -Path $Build.FullName -ChildPath "OS\sources\install.wim" 322 | $OSLocation = Join-Path -Path $Build.FullName -ChildPath "OS" 323 | 324 | if ($Global:ContentShare -like "*.wim") { 325 | Add-LogContent "Specified content location is a wim, will update existing wim, and use existing Upgrade Content Share" 326 | $updateExistingImage = $true 327 | 328 | $BuildName = $OSImageSelection.Name 329 | $destinationPath = "$Global:ContentShare" 330 | $osUpgradePath = "$Global:OSUpgradeContentShare" 331 | 332 | # Backup the Existing image File (as long as it exists) 333 | try { 334 | Add-LogContent "Backing up: $destinationPath to: $($destinationPath.Replace(".wim","-$((Get-Date).ToString(`"yyyyMMdd`")).wim"))" 335 | Move-Item -path "$destinationPath" -Destination $destinationPath.Replace(".wim","-$((Get-Date).ToString(`"yyyyMMdd`")).wim") -ErrorAction Stop 336 | Add-LogContent "Backed up: $destinationPath to: $($destinationPath.Replace(".wim","-$((Get-Date).ToString(`"yyyyMMdd`")).wim"))" 337 | } 338 | catch { 339 | $ErrorMessage = $_.Exception.Message 340 | Add-LogContent "ERROR: Unable to backup $destinationPath" 341 | Add-LogContent "ERROR: $ErrorMessage" 342 | } 343 | 344 | # Backup the Existing Upgrade Content Path 345 | if ($ImportOSUpgrade) { 346 | try { 347 | Add-LogContent "Backing Up $OSUpgradePath to: $OSUpgradePath-$((Get-Date).ToString(`"yyyyMMdd`"))" 348 | Move-Item -path "$OSUpgradePath" -Destination "$OSUpgradePath-$((Get-Date).ToString(`"yyyyMMdd`"))" -ErrorAction Stop 349 | Add-LogContent "Backed Up $OSUpgradePath to: $OSUpgradePath-$((Get-Date).ToString(`"yyyyMMdd`"))" 350 | } 351 | catch { 352 | $ErrorMessage = $_.Exception.Message 353 | Add-LogContent "ERROR: Unable to backup $destinationPath" 354 | Add-LogContent "ERROR: $ErrorMessage" 355 | } 356 | } 357 | } else { 358 | $destinationPath = "$Global:ContentShare\$($Build.Name).wim" 359 | $osUpgradePath = "$Global:OSUpgradeContentShare\$($Build.Name)" 360 | } 361 | 362 | # Upgrade and Import OS Item 363 | if ((Test-Path $wimLocation) -and (-not (Test-Path $destinationPath)) -and (-not $updateExistingImage)){ 364 | Add-LogContent "Pre-Check Complete - Import can continue" 365 | 366 | # Copy the selected install.wim to the ContentShare using the build name 367 | copy-OSDBuilderObject -Type Image -name $BuildName -source $wimLocation -destination $destinationPath 368 | 369 | # Import the newly Copied wim 370 | import-OSDBuilderObject -Type Image -Name $BuildName -Path $destinationPath -version $BuildVersion -Description $BuildDescription 371 | 372 | # Distribute the new OSImage to the Specified Distribution Point Group 373 | Update-OSContent -Type Image -Name $BuildName 374 | 375 | } 376 | elseif ((Test-Path $OSLocation) -and $updateExistingImage) { 377 | Add-LogContent "Pre-Check Complete - Updating Existing OSImage Item - Import can continue" 378 | 379 | # Copy the install.wim to the same location as the original 380 | copy-OSDBuilderObject -Type Image -name $BuildName -source $wimLocation -destination $destinationPath 381 | 382 | # Redistribute the Content 383 | Update-OSContent -Type Image -Name $BuildName 384 | } 385 | else { 386 | if (-not (Test-Path $wimLocation)){ 387 | Add-LogContent "ERROR: install.wim not found at $wimLocation - Skipping import for $($Build.Name)" 388 | } 389 | if (Test-Path $destinationPath){ 390 | Add-LogContent "ERROR: $destinationPath already exists! Skipping import for $($Build.Name)" 391 | } 392 | } 393 | 394 | # Import OSUpgradePackage 395 | if ($ImportOSUpgrade) { 396 | if ((Test-Path $OSLocation) -and (-not (Test-Path $osUpgradePath)) -and (-not $updateExistingImage)){ 397 | Add-LogContent "Pre-Check Complete - Creating New OSUpgrade Item - Import can continue" 398 | 399 | # Copy the Upgrade package to the Content Share 400 | copy-OSDBuilderObject -Type UpgradePackage -name $BuildName -source $OSLocation -destination $osUpgradePath 401 | 402 | # Import the OS Upgrade Package 403 | import-OSDBuilderObject -Type UpgradePackage -Name $BuildName -Path $osUpgradePath -version $BuildVersion -Description $BuildDescription 404 | 405 | # Distribute the Content 406 | Start-Sleep 10 ## Should help with failed content distribution 407 | Update-OSContent -Type UpgradePackage -Name $BuildName 408 | 409 | } 410 | elseif ((Test-Path $OSLocation) -and $updateExistingImage) { 411 | Add-LogContent "Pre-Check Complete - Updating Existing OSUpgrade Item - Import can continue" 412 | 413 | # Copy the Upgrade package to the Content Share 414 | $OSUpgradeName =$OSUpgradeSelection.Name 415 | copy-OSDBuilderObject -Type UpgradePackage -name $OSUpgradeName -source $OSLocation -destination $osUpgradePath 416 | 417 | # Distribute the Content 418 | Start-Sleep 10 ## Should help with failed content distribution 419 | Update-OSContent -Type UpgradePackage -Name $OSUpgradeName 420 | } 421 | Else { 422 | if (-not (Test-Path $wimLocation)){ 423 | Add-LogContent "ERROR: install.wim not found at $wimLocation - Skipping import for $($Build.Name)" 424 | } 425 | if (Test-Path $destinationPath){ 426 | Add-LogContent "ERROR: $osUpgradePath already exists! Skipping import for $($Build.Name)" 427 | } 428 | } 429 | } 430 | } 431 | 432 | if ($UpdateTS) { 433 | Push-Location 434 | Set-Location $Global:SCCMSite 435 | Add-LogContent "Waiting 60 Seconds before updating task sequence (This hopefully prevents some issues)" 436 | Start-Sleep 60 437 | Add-LogContent "Updating Task Sequence Step $TaskSequenceStepName on $TaskSequenceName with new package $BuildName" 438 | Add-LogContent "Set-CMTaskSequenceStepApplyOperatingSystem -ImagePackage (Get-CMOperatingSystemImage -Name `"$BuildName`") -ImagePackageIndex 1 -TaskSequenceName $TaskSequenceName -StepName $TaskSequenceStepName" 439 | try { 440 | Set-CMTaskSequenceStepApplyOperatingSystem -ImagePackage (Get-CMOperatingSystemImage -Name "$BuildName") -ImagePackageIndex 1 -TaskSequenceName $TaskSequenceName -StepName $TaskSequenceStepName -ErrorAction Stop 441 | } catch { 442 | $ErrorMessage = $_.Exception.Message 443 | Add-LogContent "ERROR: Failed to Update Task Sequence" 444 | Add-LogContent $ErrorMessage 445 | } 446 | Pop-Location 447 | } 448 | 449 | Add-LogContent "Import-OSBuild has Completed!" -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Andrew Jimenez 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OSBuilder-Import-Tool 2 | 3 | The purpose of this tool is to import OSBuilds and OSMedia created using David Segura's OSDBuilder module into SCCM. It's primary functions are as follows: 4 | 1. Copy the OSBuild/OSMedia into the correct content shares (wim file and optionally OS Upgrade Packages) 5 | 2. Import the OSBuild/OSMedia into SCCM Operating System Images (Optionally import OS Upgrade Package) 6 | 3. Distribute Content to a specified Distribution Point Group 7 | 4. Optionally update a specified task sequence step with the new OS Image 8 | 9 | ## Pre-Requisites 10 | Ensure that you have installed the latest OSDBuilder Module and the ConfigurationManger module 11 | This script needs to be run on the machine that OSDBuilder is run on 12 | The computer that this script is run on should also have the Configuration Manager Console installed (and the console needs to have been opened at least once) 13 | 14 | ## Instructions 15 | 1. Edit the Import-OSBuild.ps1 file and set the following Global Variables: ContentShare, OSUpgradeContentShare, SCCMSite, PreferredDistributionLoc 16 | 2. Run the script and choose the OSBuilds you want to import 17 | 3. The script will automatically copy the install.wim to your specified content location, import the wim into SCCM, and distribute the content to the selected Distribution Point Group 18 | 4. You can also choose to run the script silently by providing an OSUploadName. See examples for more usecases 19 | 20 | The Script will not copy wims (or import them into SCCM) if they already exist on the content share. 21 | 22 | ### Imports an OSBuild wim file only 23 | .\Import-OSBuild.ps1 24 | 25 | 26 | ### Import an OSBuild wim file and the cooresponding OS Upgrade Package 27 | .\Import-OSBuild.ps1 -ImportOSUpgrade 28 | 29 | 30 | ### Import the latest OSBuild with the name like "Windows 10 Enterprise x64 1809", and import the cooresponding OSUpgrade package. This flag is helpful for automating the upload process, say... after an OSBuild is completed. 31 | .\Import-OSBuild.ps1 -OSUploadName "Windows 10 Enterprise x64 1809" -ImportOSUpgrade 32 | 33 | 34 | ### Import the latest OSMedia with the name like "Windows 10 Enterprise x64 1809", then update the step "Install Windows 10 x64" in the task sequence "DEV Task Sequence" with the newly uploaded media 35 | .\Import-OSBuild.ps1 -OSUploadMedia -OSUploadName "Windows 10 Enterprise x64 1809" -UpdateTS -TaskSequenceName "DEV Task Sequence" -TaskSequenceStepName "Install Windows 10 x64" 36 | 37 | 38 | ### Import an OSMedia wim file and the cooresponding OS Upgrade Package 39 | .\Import-OSBuild -Import-OSMedia -ImportOSUpgrade 40 | 41 | 42 | ### Import an OSBuild, but do not create a new wim on the content share, instead update an exising wim 43 | ### NOTE: This flag cannot be used silently 44 | .\Import-OSBuild -UseExistingPackages 45 | 46 | 47 | ### Import an OSBuild wim file, and the cooresponding OS Upgrade Package but use an exising wim and Upgrade Package 48 | .\Import-OSBuild -UseExistingPackages -ImportOSUpgrade 49 | 50 | 51 | This is a work in progress, use at your own risk, I take no responsibility for any issues this may cause. :) 52 | --------------------------------------------------------------------------------