public/Update-BootImage.ps1
Function Update-BootImage { <# .SYNOPSIS This function updates the boot image on a deployment server and automatically imports it in to WDS .NOTES Name: Update-BootImage Author: Elliott Marter .EXAMPLE Update-BootImage -DeploymentShare D:\DeploymentShare .LINK https://www.powershellgallery.com/profiles/elliottmarter - #> [CmdletBinding()] param( [Parameter( Mandatory = $true, Position = 0 )] [string[]] $DeploymentShare ) BEGIN { # Import MDT Toolkit Import-Module "C:\Program Files\Microsoft Deployment Toolkit\bin\MicrosoftDeploymentToolkit.psd1" # Get all exisiting boot images and remove them Get-WdsBootImage | Remove-WdsBootImage } PROCESS { $DSItem = Get-Item $DeploymentShare $DSName = $DSItem.name $DSPath = $DSItem.fullname New-PSDrive -Name $DSName -PSProvider MDTProvider -Root $DSPath -Verbose Update-MDTDeploymentShare -Path "$($DSName):" -Verbose Import-WdsBootImage -NewImageName $DSName -NewDescription $DSName -Path "$DSPath\Boot\LiteTouchPE_x64.wim" -Verbose Get-PSDrive -Name $DSName | Remove-PSDrive -Verbose } END {} } |