AL/Download-Symbols.ps1
function Download-Symbols { Param( [Parameter(Mandatory=$false)] [string]$SourcePath = (Get-Location), [Parameter(Mandatory=$false)] [string]$ContainerName = (Split-Path (Get-Location) -Leaf) ) $PackagesPath = Join-Path $SourcePath '.alpackages' if (!(Test-Path $PackagesPath)) { Create-EmptyDirectory $PackagesPath } #application $Response = Invoke-WebRequest -Uri ('http://{0}:7049/nav/dev/packages?publisher=Microsoft&appName=Application&versionText={1}' -f $ContainerName, (Get-AppKeyValue -SourcePath $SourcePath -KeyName 'application')) -Headers (Create-Headers) -OutFile (Join-Path $PackagesPath 'Microsoft_Application.app') #system $Response = Invoke-WebRequest -Uri ('http://{0}:7049/nav/dev/packages?publisher=Microsoft&appName=System&versionText={1}' -f $ContainerName, (Get-AppKeyValue -SourcePath $SourcePath -KeyName 'application')) -Headers (Create-Headers) -OutFile (Join-Path $PackagesPath 'Microsoft_System.app') #test #$Response = Invoke-WebRequest -Uri ('http://{0}:7049/nav/dev/packages?publisher=Microsoft&appName=Test&versionText={1}' -f $ContainerName, (Get-AppKeyValue -SourcePath $SourcePath -KeyName 'application')) -Headers (Create-Headers) -OutFile (Join-Path $PackagesPath 'Microsoft_Test.app') } function Create-Headers { $ba = '{0}:{1}' -f (Get-EnvironmentKeyValue -KeyName 'user'), (Get-EnvironmentKeyValue -KeyName 'password') $ba = [System.Text.Encoding]::UTF8.GetBytes($ba) $ba = [System.Convert]::ToBase64String($ba) $h = @{Authorization=("Basic {0}" -f $ba);'Accept-Encoding'='gzip,deflate'} $h } Export-ModuleMember -Function Download-Symbols |