Public/Functions/OSDCloud/New-OSDCloudISO.ps1
<#
.SYNOPSIS Creates an .iso file in the OSDCloud Workspace. ADK is required .Description Creates an .iso file in the OSDCloud Workspace. ADK is required .PARAMETER WorkspacePath Path to the OSDCloud Workspace containing the Media directory .LINK https://osdcloud.osdeploy.com #> function New-OSDCloudISO { [CmdletBinding()] param ( [Parameter(Position=0,ValueFromPipelineByPropertyName)] [System.String]$WorkspacePath ) #================================================= # Block #================================================= Block-NoCurl Block-PowerShellVersionLt5 Block-StandardUser Block-WindowsVersionNe10 Block-WinPE #================================================= # Initialize #================================================= $isoFileName = 'OSDCloud.iso' $isoLabel = 'OSDCloud' $ErrorActionPreference = 'Stop' #================================================= # WorkspacePath #================================================= if ($PSBoundParameters.ContainsKey('WorkspacePath')) { Set-OSDCloudWorkspace -WorkspacePath $WorkspacePath -ErrorAction Stop | Out-Null } $WorkspacePath = Get-OSDCloudWorkspace -ErrorAction Stop if (-NOT ($WorkspacePath)) { Write-Warning "$((Get-Date).ToString('yyyy-MM-dd-HHmmss')) Unable to find an OSDCloud Workspace at $WorkspacePath" Break } if (-NOT (Test-Path $WorkspacePath)) { Write-Warning "$((Get-Date).ToString('yyyy-MM-dd-HHmmss')) Unable to find an OSDCloud Workspace at $WorkspacePath" Break } if (-NOT (Test-Path "$WorkspacePath\Media\sources\boot.wim")) { Write-Warning "$((Get-Date).ToString('yyyy-MM-dd-HHmmss')) Unable to find an OSDCloud WinPE at $WorkspacePath\Media\sources\boot.wim" Break } #================================================= # Create ISO #================================================= $NewADKiso = New-ADK.iso -MediaPath "$WorkspacePath\Media" -isoFileName $isoFileName -isoLabel $isoLabel #================================================= # Complete #================================================= #Write-Host -ForegroundColor Cyan "$((Get-Date).ToString('yyyy-MM-dd-HHmmss')) New-OSDCloudISO is complete" #================================================= } |