src/Publish-CciCustomizationBats.ps1

function Publish-CciCustomizationBats {
    [CmdletBinding()]
    param (
        $targetDir = 'C:\Users\public\Desktop',
        $moduleName
    )
    begin {
        Write-Verbose "$(Get-Date) : Started running $($MyInvocation.MyCommand)"
        $sequences = Get-Content "C:\CCI\$($moduleName)\artifacts\sequences.json" | ConvertFrom-json
    }
    process {
        foreach ($sequence in ($sequences | Get-Member -MemberType NoteProperty).Name) {
            $bat = New-Item -Name "$($sequence).bat" -Path $targetDir -ItemType File
            Add-Content -Path $bat.FullName -Value "powershell -NoProfile -ExecutionPolicy Bypass -Command `"& {Start-Process powershell.exe -ArgumentList 'Set-ExecutionPolicy Bypass -Force; Get-cciModule -Name $($moduleName); Import-module c:\CCI\$($moduleName)\$($moduleName).psd1 -Force; Initialize-CciCustomizationsSequence -Template $($sequences.$sequence)' -Verb RunAs}`""
        }
    }
    end {
        Write-Verbose "$(Get-Date) : Finished running $($MyInvocation.MyCommand)"
    }
}
#(goto) 2>nul & del "%~f0"