Created
February 23, 2017 16:54
-
-
Save tugberkugurlu/216484ed4265ab6943993bf55dc84f72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-Project -All | ? { $_.ProjectName } | % { Get-Package -ProjectName $_.ProjectName } | sort -property Id -unique | % { | |
$pkg = $_ ; | |
Try { | |
$targetFile = "C:\sqlclone-licenses\$($pkg.Id)-$($pkg.Version).txt" | |
(New-Object System.Net.WebClient).DownloadFile($pkg.LicenseUrl, $targetFile) | |
$lineToAppend = "License downloaded from '$($pkg.LicenseUrl)' on '$([DateTime]::UtcNow.ToString('R'))'$([Environment]::NewLine)$([Environment]::NewLine)" | |
Set-Content $targetFile ($lineToAppend + (get-content $targetFile)) | |
} Catch [system.exception] { | |
Write-Host "Could not download license for ($pkg.Id)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment