Merge branch 'master' into v-vlsafo/msys2-install

This commit is contained in:
Vladimir Safonkin
2020-03-24 20:14:08 +03:00
53 changed files with 617 additions and 668 deletions

View File

@@ -14,10 +14,15 @@ Export-ModuleMember -Function @(
'Set-SystemVariable'
'Install-MSI'
'Install-EXE'
'Get-ToolcachePackages'
'Get-ToolsByName'
'Add-ContentToMarkdown'
'Add-SoftwareDetailsToMarkdown'
'Stop-SvcWithErrHandling'
'Set-SvcWithErrHandling'
'Install-VsixExtension'
'Get-VS19ExtensionVersion'
'Get-VSExtensionVersion'
'Get-WinVersion'
'Test-IsWin19'
'Test-IsWin16'
)

View File

@@ -165,46 +165,62 @@ function Install-VsixExtension
{
Param
(
[String]$Url,
[String]$Name
[string] $Url,
[Parameter(Mandatory = $true)]
[string] $Name,
[string] $FilePath,
[Parameter(Mandatory = $true)]
[string] $VSversion,
[int] $retries = 20,
[switch] $InstallOnly
)
$FilePath = "${env:Temp}\$Name"
$retries = 20
while($retries -gt 0)
if (!$InstallOnly)
{
try
{
Write-Host "Downloading $Name..."
(New-Object System.Net.WebClient).DownloadFile($Url, $FilePath)
break
}
catch
{
Write-Host "There is an error during $Name downloading"
$_
$FilePath = "${env:Temp}\$Name"
$retries--
if ($retries -eq 0)
while($retries -gt 0)
{
try
{
Write-Host "File can't be downloaded"
$_
exit 1
Write-Host "Downloading $Name..."
(New-Object System.Net.WebClient).DownloadFile($Url, $FilePath)
break
}
catch
{
Write-Host "There is an error during $Name downloading"
$_
Write-Host "Waiting 30 seconds before retrying. Retries left: $retries"
Start-Sleep -Seconds 30
$retries--
if ($retries -eq 0)
{
Write-Host "File can't be downloaded"
$_
exit 1
}
Write-Host "Waiting 30 seconds before retrying. Retries left: $retries"
Start-Sleep -Seconds 30
}
}
}
$ArgumentList = ('/quiet', $FilePath)
$ArgumentList = ('/quiet', "`"$FilePath`"")
Write-Host "Starting Install $Name..."
try
{
$process = Start-Process -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\VSIXInstaller.exe" -ArgumentList $ArgumentList -Wait -PassThru
#There are 2 types of packages at the moment - exe and vsix
if ($Name -match "vsix")
{
$process = Start-Process -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\$VSversion\Enterprise\Common7\IDE\VSIXInstaller.exe" -ArgumentList $ArgumentList -Wait -PassThru
}
else
{
$process = Start-Process -FilePath ${env:Temp}\$Name /Q -Wait -PassThru
}
}
catch
{
@@ -225,11 +241,14 @@ function Install-VsixExtension
exit 1
}
#Cleanup installation files
Remove-Item -Force -Confirm:$false $FilePath
#Cleanup downloaded installation files
if (!$InstallOnly)
{
Remove-Item -Force -Confirm:$false $FilePath
}
}
function Get-VS19ExtensionVersion
function Get-VSExtensionVersion
{
param (
[string] [Parameter(Mandatory=$true)] $packageName
@@ -255,3 +274,41 @@ function Get-VS19ExtensionVersion
return $packageVersion
}
function Get-ToolcachePackages {
$toolcachePath = Join-Path $env:ROOT_FOLDER "toolcache.json"
Get-Content -Raw $toolcachePath | ConvertFrom-Json
}
function Get-ToolsByName {
param (
[Parameter(Mandatory = $True)]
[string]$SoftwareName
)
(Get-ToolcachePackages).PSObject.Properties | Where-Object { $_.Name -match $SoftwareName } | ForEach-Object {
$packageNameParts = $_.Name.Split("-")
[PSCustomObject] @{
ToolName = $packageNameParts[1]
Versions = $_.Value
Architecture = $packageNameParts[3,4] -join "-"
}
}
}
function Get-WinVersion
{
(Get-WmiObject -class Win32_OperatingSystem).Caption
}
function Test-IsWin19
{
(Get-WinVersion) -match "2019"
}
function Test-IsWin16
{
(Get-WinVersion) -match "2016"
}

View File

@@ -0,0 +1,2 @@
Write-Host "Set antivirus parameters"
Set-MpPreference -ScanAvgCPULoadFactor 5 -ExclusionPath "D:\", "C:\"

View File

@@ -4,9 +4,11 @@
## Desc: Install boost using tool cache
################################################################################
$BoostDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath "Boost"
$BoostVersions = $env:BOOST_VERSIONS.split(',')
$BoostDefault = $env:BOOST_DEFAULT
Import-Module -Name ImageHelpers
$SoftwareName = "Boost"
$BoostDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $SoftwareName
$BoostVersions = (Get-ToolsByName -SoftwareName $SoftwareName).Versions | Foreach-Object {"{0}.0" -f $_}
foreach($BoostVersion in $BoostVersions)
{
@@ -14,13 +16,4 @@ foreach($BoostVersion in $BoostVersions)
$EnvBoostPath = "BOOST_ROOT_{0}" -f ($BoostVersion.Replace('.', '_'))
setx $EnvBoostPath $BoostInstallationDir /M | Out-Null
if ($BoostVersion -eq $BoostDefault)
{
Write-Host "Adding Boost $BoostVersion to the path..."
# Add the Boost binaries to the path
Add-MachinePathItem $BoostInstallationDir | Out-Null
# Set the BOOSTROOT environment variable
setx BOOST_ROOT $BoostInstallationDir /M | Out-Null
}
}

View File

@@ -14,3 +14,7 @@ Install-Package -Name docker -ProviderName DockerMsftProvider -Force
Start-Service docker
choco install docker-compose -y
# Install helm
Write-Host "Install Helm"
choco install kubernetes-helm

View File

@@ -8,6 +8,7 @@ Import-Module -Name ImageHelpers
# Install the latest version of Git which is bundled with Git LFS.
# See https://chocolatey.org/packages/git
choco install git -y --package-parameters="/GitAndUnixToolsOnPath /WindowsTerminal /NoShellIntegration"
choco install hub
# Disable GCM machine-wide
[Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine)

View File

@@ -10,8 +10,11 @@ Import-Module -Name ImageHelpers
$installDir = "c:\tools\php"
choco install php -y --force --params "/InstallDir:$installDir"
# update path to extensions and enable curl and mbstring extensions
((Get-Content -path $installDir\php.ini -Raw) -replace ';extension=curl','extension=curl' -replace ';extension=mbstring','extension=mbstring' -replace ';extension_dir = "ext"','extension_dir = "ext"') | Set-Content -Path $installDir\php.ini
# Install latest Composer in chocolatey
choco install composer --ia "/DEV=$installDir /PHP=$installDir"
# update path to extensions and enable curl and mbstring extensions, and enable php openssl extensions.
((Get-Content -path $installDir\php.ini -Raw) -replace ';extension=curl','extension=curl' -replace ';extension=mbstring','extension=mbstring' -replace ';extension_dir = "ext"','extension_dir = "ext"' -replace 'extension=";php_openssl.dll"','extension_dir = "php_openssl.dll"') | Set-Content -Path $installDir\php.ini
# Set the PHPROOT environment variable.
setx PHPROOT $installDir /M

View File

@@ -14,7 +14,7 @@ $env:CARGO_HOME="C:\Rust\.cargo"
Invoke-WebRequest -UseBasicParsing -Uri "https://win.rustup.rs/x86_64" -OutFile rustup-init.exe
# Install Rust by running rustup-init.exe (disabling the confirmation prompt with -y)
.\rustup-init.exe -y
.\rustup-init.exe -y --default-toolchain=stable --profile=minimal
# Delete rustup-init.exe when it's no longer needed
Remove-Item -Path .\rustup-init.exe
@@ -24,10 +24,8 @@ Add-MachinePathItem "$env:CARGO_HOME\bin"
$env:Path = Get-MachinePath
# Install common tools
rustup component add rustfmt
rustup component add clippy
cargo install bindgen
cargo install cbindgen
rustup component add rustfmt clippy
cargo install bindgen cbindgen
# Run script at startup for all users
$cmdRustSymScript = @"

View File

@@ -4,8 +4,24 @@
################################################################################
# Requires Windows SDK with the same version number as the WDK
$winSdkUrl = "https://go.microsoft.com/fwlink/p/?linkid=2083338"
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2085767"
Import-Module -Name ImageHelpers -Force
if(Test-IsWin19)
{
$winSdkUrl = "https://go.microsoft.com/fwlink/p/?linkid=2083338"
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2085767"
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019\WDK.vsix"
$VSver = "2019"
}
else
{
$winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014"
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156"
$FilePath = "C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"
$VSver = "2017"
}
# `winsdksetup.exe /features + /quiet` installs all features without showing the GUI
$sdkExitCode = Install-EXE -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList ("/features", "+", "/quiet")
@@ -26,32 +42,4 @@ if ($wdkExitCode -ne 0)
}
# Need to install the VSIX to get the build targets when running VSBuild
# Write-Host "Installing WDK.vsix"
try
{
$process = Start-Process `
-FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\VSIXInstaller.exe" `
-ArgumentList ("/quiet", '"C:\Program Files (x86)\Windows Kits\10\Vsix\VS2019\WDK.vsix"') `
-Wait `
-PassThru
}
catch
{
Write-Host "There is an error during WDK.vsix installation"
$_
exit 1
}
$exitCode = $process.ExitCode
if ($exitCode -eq 0 -or $exitCode -eq 1001) # 1001 means the extension is already installed
{
Write-Host "WDK.vsix installed successfully"
}
else
{
Write-Host "Unsuccessful exit code returned by the installation process: $exitCode."
}
exit $exitCode
Install-VsixExtension -FilePath $FilePath -Name "WDK.vsix" -VSversion $VSver -InstallOnly

View File

@@ -0,0 +1,23 @@
################################################################################
## File: Install-Wix.ps1
## Desc: Install WIX.
################################################################################
Import-Module -Name ImageHelpers -Force;
choco install wixtoolset -y --force
if(Test-IsWin19)
{
$extensionUrl = "https://wixtoolset.gallerycdn.vsassets.io/extensions/wixtoolset/wixtoolsetvisualstudio2019extension/1.0.0.4/1563296438961/Votive2019.vsix"
$VSver = "2019"
}
else
{
$extensionUrl = "https://robmensching.gallerycdn.vsassets.io/extensions/robmensching/wixtoolsetvisualstudio2017extension/0.9.21.62588/1494013210879/250616/4/Votive2017.vsix"
$VSver = "2017"
}
$extensionName = "Votive$VSver.vsix"
#Installing VS extension 'Wix Toolset Visual Studio Extension'
Install-VsixExtension -Url $extensionUrl -Name $extensionName -VSversion $VSver

View File

@@ -0,0 +1,30 @@
################################################################################
## File: Run-Antivirus.ps1
## Desc: Run a full antivirus scan.
## Run right after cleanup before we sysprep
################################################################################
if ($env:run_scan_antivirus -eq $true) {
try {
Update-MpSignature
}
catch {
Write-Host "Some error was found"
Write-Host $_
}
Write-Host "Make sure windefend is going to start"
Start-Service windefend -ErrorAction Continue
Write-Host "Waiting for windefend to report as running"
$service = Get-Service "Windefend"
$service.WaitForStatus("Running","00:10:00")
Write-Host "Run antivirus"
# Tell Defender to use 100% of the CPU during the scan
Set-MpPreference -ScanAvgCPULoadFactor 100
# Full Scan
Start-Process -FilePath "C:\Program Files\Windows Defender\MpCmdRun.exe" -ArgumentList ("-Scan","-ScanType", 2) -Wait
}
else {
Write-Host "Scanning process has been skipped"
}

View File

@@ -110,6 +110,7 @@ Push-Location -Path $sdk.FullName
"add-ons;addon-google_apis-google-22" `
"add-ons;addon-google_apis-google-21" `
"cmake;3.6.4111459" `
"cmake;3.10.2.4988404" `
"patcher;v4"
Pop-Location

View File

@@ -3,6 +3,8 @@
## Desc: Validate Boost
################################################################################
Import-Module -Name ImageHelpers
function Validate-BoostVersion
{
Param
@@ -16,7 +18,6 @@ function Validate-BoostVersion
if (Test-Path "$ReleasePath\b2.exe")
{
Write-Host "Boost.Build $BoostRelease is successfully installed"
return
}
@@ -24,52 +25,46 @@ function Validate-BoostVersion
exit 1
}
# Verify that Boost is on the path
if (Get-Command -Name 'b2')
{
Write-Host "Boost is on the path"
}
else
{
Write-Host "Boost is not on the path"
exit 1
}
# Adding description of the software to Markdown
$tmplMark = @"
#### {0}
#### {0} [{2}]
_Environment:_
* {1}: root directory of the Boost version {0} installation
"@
$tmplMarkRoot = @"
#### {0}
* PATH: contains the location of Boost version {0}
* BOOST_ROOT: root directory of the Boost version {0} installation
* {1}: root directory of the Boost version {0} installation
"@
$SoftwareName = 'Boost'
$Description = New-Object System.Text.StringBuilder
$BoostRootDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath "Boost"
$BoostVersionsToInstall = $env:BOOST_VERSIONS.split(",")
$SoftwareName = 'Boost'
$BoostRootDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $SoftwareName
$BoostTools = Get-ToolsByName -SoftwareName $SoftwareName
foreach($BoostVersion in $BoostVersionsToInstall)
foreach ($BoostTool in $BoostTools)
{
Validate-BoostVersion -BoostRootPath $BoostRootDirectory -BoostRelease $BoostVersion
$BoostVersionTag = "BOOST_ROOT_{0}" -f $BoostVersion.Replace('.', '_')
$BoostToolsetName = $BoostTool.Architecture
$BoostVersionsToInstall = $BoostTool.Versions | Foreach-Object {"{0}.0" -f $_}
foreach($BoostVersion in $BoostVersionsToInstall)
{
Validate-BoostVersion -BoostRootPath $BoostRootDirectory -BoostRelease $BoostVersion
$BoostVersionTag = "BOOST_ROOT_{0}" -f $BoostVersion.Replace('.', '_')
if($BoostVersion -eq $env:BOOST_DEFAULT)
{
$null = $Description.AppendLine(($tmplMarkRoot -f $BoostVersion, $BoostVersionTag))
}
else
{
$null = $Description.AppendLine(($tmplMark -f $BoostVersion, $BoostVersionTag))
$null = $Description.AppendLine(($tmplMark -f $BoostVersion, $BoostVersionTag, $BoostToolsetName))
}
}
$CMakeFindBoostInfo = @"
#### _Notes:_
Link: https://cmake.org/cmake/help/latest/module/FindBoost.html
If Boost was built using the ``boost-cmake`` project or from ``Boost 1.70.0`` on it provides a package
configuration file for use with find\_package's config mode. This module looks for the package
configuration file called BoostConfig.cmake or boost-config.cmake and stores the result in CACHE entry "Boost_DIR".
If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the Boost CMake package configuration for details on what it provides.
Set ``Boost_NO_BOOST_CMAKE to ON``, to disable the search for boost-cmake.
"@
$null = $Description.AppendLine($CMakeFindBoostInfo)
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString()

View File

@@ -44,3 +44,25 @@ _Environment:_
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
# Validate helm
if (Get-Command -Name 'helm')
{
Write-Host "helm on path"
}
else
{
Write-Host 'helm is not on path'
exit 1
}
$version = $(helm version --short)
$SoftwareName = "Helm"
$Description = @"
_Version:_ $version<br/>
_Environment:_
* PATH: contains location of helm
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -2,48 +2,61 @@
## File: Validate-Git.ps1
## Desc: Validate Git for Windows
################################################################################
if((Get-Command -Name 'git') -and (Get-Command -Name 'bash') -and (Get-Command -Name 'awk') -and (Get-Command -Name 'git-lfs'))
{
Write-Host "$(git version) on path"
Write-Host "$(git-lfs version) on path"
function Test-CommandName {
param(
[parameter(Mandatory)][string] $CommandName
)
Write-Host "Checking the [$CommandName]"
if(-not (Get-Command $CommandName -ErrorAction "Continue")) {
Write-Host "[!] $CommandName is not found"
exit 1
}
}
else
{
Write-Host "git or git-lfs are not on path."
exit 1
function Test-Command {
param(
[parameter(Mandatory)][string] $CommandName,
[parameter(Mandatory)][string] $CommandDescription,
[parameter(Mandatory)][string] $VersionCmd,
[parameter(Mandatory)][string] $regexVersion,
[parameter(Mandatory)][string] $DescriptionMarkdown
)
Test-CommandName -CommandName $CommandName
$strVersion = Invoke-Expression $VersionCmd
Write-Host "$strVersion on path"
if($strVersion -match $regexVersion) {
$Version = $Matches.version
}
else {
Write-Host "[!] $CommandName version detection failed"
exit 1
}
# Adding description of the software to Markdown
$DescriptionMarkdown = $DescriptionMarkdown -f $Version
Add-SoftwareDetailsToMarkdown -SoftwareName $CommandDescription -DescriptionMarkdown $DescriptionMarkdown
}
Test-CommandName -CommandName 'bash'
Test-CommandName -CommandName 'awk'
if( $(git version) -match 'git version (?<version>.*).win.*' )
{
$gitVersion = $Matches.version
}
if( $(git-lfs version) -match 'git-lfs\/(?<version>.*) \(Git.*' )
{
$gitLfsVersion = $Matches.version
}
# Adding description of the software to Markdown
$SoftwareName = "Git"
$Description = @"
_Version:_ $gitVersion<br/>
$GitDescription = @"
_Version:_ {0}<br/>
_Environment:_
* PATH: contains location of git.exe
"@
Test-Command -CommandName 'git' -CommandDescription 'Git' -VersionCmd "git version" -regexVersion 'git version (?<version>.*).win.*' -DescriptionMarkdown $GitDescription
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
# Adding description of the software to Markdown
$SoftwareName = "Git Large File Storage (LFS)"
$Description = @"
_Version:_ $gitLfsVersion<br/>
$GitLfsDescription = @"
_Version:_ {0}<br/>
_Environment:_
* PATH: contains location of git-lfs.exe
* GIT_LFS_PATH: location of git-lfs.exe
"@
Test-Command -CommandName 'git-lfs' -CommandDescription 'Git Large File Storage (LFS)' -VersionCmd "git-lfs version" -regexVersion 'git-lfs\/(?<version>.*) \(Git.*' -DescriptionMarkdown $GitLfsDescription
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
$HubCliDescription = @"
_Version:_ {0}<br/>
_Environment:_
* PATH: contains location of hub.exe
"@
Test-Command -CommandName 'hub' -CommandDescription 'Hub CLI' -VersionCmd "hub version | Select-String 'hub version'" -regexVersion 'hub version (?<version>.*)' -DescriptionMarkdown $HubCliDescription

View File

@@ -56,7 +56,7 @@ if( $( $(gradle -version) | Out-String) -match 'Gradle (?<version>.*)' )
$SoftwareName = "Java Development Kit"
$Description = @"
#### $javaVersion
#### $javaVersion (default)
_Environment:_
* JAVA_HOME: location of JDK

View File

@@ -28,5 +28,4 @@ $Description = @"
_Version:_ $Version<br/>
"@
#Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
Write-Host $description
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -33,6 +33,32 @@ else
exit 1
}
# Verify that composer.exe is on the path
if(Get-Command -Name 'composer')
{
Write-Host "$(composer --version) is on the path."
}
else
{
Write-Host "composer is not on the path."
exit 1
}
# Get the composer version.
$composerVersion = $(composer --version)
# Add composer version details in Markdown
$SoftwareName = "Composer"
$Description = @"
#### $composerVersion
_Environment:_
* PATH: contains the location of composer.exe version $composerVersion
* PHPROOT: root directory of the Composer $composerVersion installation
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
# Get available versions of PHP
$phpVersionOnPath = Get-PHPVersion -phpRootPath "C:\tools\php72"

View File

@@ -19,7 +19,7 @@ function Get-WDKVersion
}
$WDKVersion = Get-WDKVersion
$WDKPackageVersion = Get-VS19ExtensionVersion -packageName "Microsoft.Windows.DriverKit"
$WDKPackageVersion = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit"
# Adding description of the software to Markdown
$SoftwareName = "Windows Driver Kit"

View File

@@ -4,6 +4,7 @@
################################################################################
Import-Module -Name ImageHelpers -Force
function Get-WixVersion {
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$installedApplications = Get-ItemProperty -Path $regKey
@@ -21,14 +22,23 @@ else {
exit 1
}
$WixPackageVersion = Get-VS19ExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16"
if(Test-IsWin19)
{
$WixPackageVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16"
$VSver = "2019"
}
else
{
$WixPackageVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev15"
$VSver = "2017"
}
# Adding description of the software to Markdown
$SoftwareName = "WIX Tools"
$Description = @"
_Toolset Version:_ $WixToolSetVersion<br/>
_WIX Toolset Visual Studio Extension Version:_ $WixPackageVersion<br/>
_WIX Toolset Studio $VSver Extension Version:_ $WixPackageVersion<br/>
_Environment:_
* WIX: Installation root of WIX
"@

View File

@@ -8,7 +8,13 @@ function Disable-InternetExplorerESC {
$UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force
Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force
Stop-Process -Name Explorer -Force -ErrorAction Continue
$ieProcess = Get-Process -Name Explorer -ErrorAction SilentlyContinue
if ($ieProcess){
Stop-Process -Name Explorer -Force -ErrorAction Continue
}
Write-Host "IE Enhanced Security Configuration (ESC) has been disabled."
}

View File

@@ -1,51 +0,0 @@
################################################################################
## File: Install-WDK.ps1
## Desc: Install the Windows Driver Kit
################################################################################
# Version: 10.0.17763.0
# Update Validate-WDK.ps1 if the version changes!
# There doesn't seem to be any way to check the version programmatically
# Requires Windows SDK with the same version number as the WDK
$winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014"
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156"
# `winsdksetup.exe /features + /quiet` installs all features without showing the GUI
$sdkExitCode = Install-EXE -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList ("/features", "+", "/quiet")
if ($sdkExitCode -ne 0)
{
Write-Host "Failed to install the Windows SDK."
exit $sdkExitCode
}
# `wdksetup.exe /features + /quiet` installs all features without showing the GUI
$wdkExitCode = Install-EXE -Url $wdkUrl -Name "wdksetup.exe" -ArgumentList ("/features", "+", "/quiet")
if ($wdkExitCode -ne 0)
{
Write-Host "Failed to install the Windows Driver Kit."
exit $wdkExitCode
}
# Need to install the VSIX to get the build targets when running VSBuild
Write-Host "Installing WDK.vsix"
$process = Start-Process `
-FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe" `
-ArgumentList ("/quiet", '"C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"') `
-Wait `
-PassThru
$exitCode = $process.ExitCode
if ($exitCode -eq 0 -or $exitCode -eq 1001) # 1001 means the extension is already installed
{
Write-Host "WDK.vsix installed successfully"
}
else
{
Write-Host "Unsuccessful exit code returned by the installation process: $exitCode."
}
exit $exitCode

View File

@@ -1,53 +0,0 @@
################################################################################
## File: Install-Wix.ps1
## Desc: Install WIX.
################################################################################
function Install-VsixExtension
{
Param
(
[String]$Url,
[String]$Name
)
$exitCode = -1
try
{
Write-Host "Downloading $Name..."
$FilePath = "${env:Temp}\$Name"
Invoke-WebRequest -Uri $Url -OutFile $FilePath
$ArgumentList = ('/quiet', $FilePath)
Write-Host "Starting Install $Name..."
$process = Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe' -ArgumentList $ArgumentList -Wait -PassThru
$exitCode = $process.ExitCode
if ($exitCode -eq 0 -or $exitCode -eq 3010)
{
Write-Host -Object 'Installation successful'
return $exitCode
}
else
{
Write-Host -Object "Non zero exit code returned by the installation process : $exitCode."
return $exitCode
}
}
catch
{
Write-Host -Object "Failed to install the Extension $Name"
Write-Host -Object $_.Exception.Message
return -1
}
}
choco install wixtoolset -y --force
#Installing VS extension 'Wix Toolset Visual Studio 2017 Extension'
$exitCode = Install-VsixExtension -Url 'https://robmensching.gallerycdn.vsassets.io/extensions/robmensching/wixtoolsetvisualstudio2017extension/0.9.21.62588/1494013210879/250616/4/Votive2017.vsix' -Name 'Votive2017.vsix'
return $exitCode

View File

@@ -1,19 +0,0 @@
################################################################################
## File: Run-Antivirus.ps1
## Desc: Run a full antivirus scan.
## Run right after cleanup before we sysprep
################################################################################
Write-Host "Run antivirus"
Push-Location "C:\Program Files\Windows Defender"
# Tell Defender to use 100% of the CPU during the scan
Set-MpPreference -ScanAvgCPULoadFactor 100
# Full Scan
.\MpCmdRun.exe -Scan -ScanType 2
Pop-Location
Write-Host "Set antivirus parmeters"
Set-MpPreference -ScanAvgCPULoadFactor 5 `
-ExclusionPath "D:\", "C:\"

View File

@@ -5,39 +5,13 @@
Import-Module -Name ImageHelpers -Force
function Get-SSDTExtensionPackage {
$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances"
$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName
if($instanceFolders -is [array])
{
Write-Host "More than one instance installed"
exit 1
}
$stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json')
$state = $stateContent | ConvertFrom-Json
$SsdtPackage = $state.packages | where { $_.id -eq "SSDT" }
return $SsdtPackage
}
$SsdtPackage = Get-SSDTExtensionPackage
if($SsdtPackage){
Write-Host "SSDT version" $SsdtPackage.version "installed"
}
else {
Write-Host "SSDT is not installed"
exit 1
}
$SSDTPackageVersion = Get-VSExtensionVersion -packageName "SSDT"
# Adding description of the software to Markdown
$SoftwareName = "SQL Server Data Tools for VS 2017"
$Description = @"
_Version:_ $($SsdtPackage.version)<br/>
_Version:_ $SSDTPackageVersion<br/>
The following components are installed:

View File

@@ -1,13 +0,0 @@
################################################################################
## File: Validate-WDK.ps1
## Desc: Validate the installation of the Windows Driver Kit
################################################################################
# Adding description of the software to Markdown
$SoftwareName = "Windows Driver Kit"
$Description = @"
_Version:_ 10.0.17763.0<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -1,62 +0,0 @@
################################################################################
## File: Validate-Wix.ps1
## Desc: Validate WIX.
################################################################################
Import-Module -Name ImageHelpers -Force
function Get-WixVersion {
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$installedApplications = Get-ItemProperty -Path $regKey
$Version = ($installedApplications | Where-Object { $_.DisplayName -and $_.DisplayName.toLower().Contains("wix") } | Select-Object -First 1).DisplayVersion
return $Version
}
#Gets the extension details from state.json
function Get-WixExtensionPackage {
$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances"
$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName
if($instanceFolders -is [array])
{
Write-Host "More than one instance installed"
exit 1
}
$stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json')
$state = $stateContent | ConvertFrom-Json
$WixPackage = $state.packages | where { $_.id -eq "WixToolset.VisualStudioExtension.Dev15" }
return $WixPackage
}
$WixToolSetVersion = Get-WixVersion
if($WixToolSetVersion) {
Write-Host "Wix Toolset version" $WixPackage.version "installed"
}
else {
Write-Host "Wix Toolset is not installed"
exit 1
}
$WixPackage = Get-WixExtensionPackage
if($WixPackage) {
Write-Host "Wix Extension version" $WixPackage.version "installed"
}
else {
Write-Host "Wix Extension is not installed"
exit 1
}
# Adding description of the software to Markdown
$SoftwareName = "WIX Tools"
$Description = @"
_Toolset Version:_ $WixToolSetVersion<br/>
_WIX Toolset Studio 2017 Extension Version:_ $($WixPackage.version)<br/>
_Environment:_
* WIX: Installation root of WIX
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -8,7 +8,13 @@ function Disable-InternetExplorerESC {
$UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force
Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force
Stop-Process -Name Explorer -Force -ErrorAction Continue
$ieProcess = Get-Process -Name Explorer -ErrorAction SilentlyContinue
if ($ieProcess){
Stop-Process -Name Explorer -Force -ErrorAction Continue
}
Write-Host "IE Enhanced Security Configuration (ESC) has been disabled."
}

View File

@@ -1,11 +0,0 @@
###################################################################################
## File: Install-AnalysisExtenstion.ps1
## Desc: Install the Microsoft Analysis Services Projects Visual Studio extension
###################################################################################
Import-Module -Name ImageHelpers -Force;
$extensionUrl = "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ProBITools/vsextensions/MicrosoftAnalysisServicesModelingProjects/2.9.5/vspackage"
$extensionName = "Microsoft.DataTools.AnalysisServices.vsix"
Install-VsixExtension -Url $extensionUrl -Name $extensionName

View File

@@ -0,0 +1,11 @@
###################################################################################
## File: Install-SSDTExtensions.ps1
## Desc: Install the extensions previously known as SSDT package
###################################################################################
Import-Module -Name ImageHelpers -Force
Install-VsixExtension -Url 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ProBITools/vsextensions/MicrosoftAnalysisServicesModelingProjects/2.9.5/vspackage' -Name 'Microsoft.DataTools.AnalysisServices.vsix' -VSversion "2019"
Install-VsixExtension -Url 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/SSIS/vsextensions/SqlServerIntegrationServicesProjects/3.4/vspackage' -Name 'Microsoft.DataTools.IntegrationServices.exe' -VSversion "2019"
Install-VsixExtension -Url 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ProBITools/vsextensions/MicrosoftReportProjectsforVisualStudio/2.6.3/vspackage' -Name 'Microsoft.DataTools.ReportingServices.vsix' -VSversion "2019"

View File

@@ -121,6 +121,7 @@ $WorkLoads = '--allWorkloads --includeRecommended ' + `
'--add Microsoft.VisualStudio.Component.VC.v141.MFC.ARM.Spectre ' + `
'--add Microsoft.VisualStudio.Component.VC.v141.MFC.ARM64.Spectre ' + `
'--add Microsoft.VisualStudio.Component.VC.v141.MFC.Spectre ' + `
'--add Microsoft.VisualStudio.Component.Windows10SDK.14393 ' + `
'--add Microsoft.VisualStudio.Component.Windows10SDK.16299 ' + `
'--add Microsoft.VisualStudio.Component.Windows10SDK.17134 ' + `
'--add Microsoft.VisualStudio.Component.Windows10SDK.17763 ' + `

View File

@@ -1,14 +0,0 @@
################################################################################
## File: Install-Wix.ps1
## Desc: Install WIX.
################################################################################
Import-Module -Name ImageHelpers -Force;
choco install wixtoolset -y --force
$extensionUrl = "https://wixtoolset.gallerycdn.vsassets.io/extensions/wixtoolset/wixtoolsetvisualstudio2019extension/1.0.0.4/1563296438961/Votive2019.vsix"
$extensionName = "Votive2019.vsix"
#Installing VS extension 'Wix Toolset Visual Studio 2019 Extension'
Install-VsixExtension -Url $extensionUrl -Name $extensionName

View File

@@ -1,27 +0,0 @@
################################################################################
## File: Run-Antivirus.ps1
## Desc: Run a full antivirus scan.
## Run right after cleanup before we sysprep
################################################################################
Write-Host "Make sure windefend is going to start"
Start-Service windefend -ErrorAction Continue
Write-Host "Waiting for windefend to report as running"
$service = Get-Service "Windefend"
$service.WaitForStatus("Running","00:10:00")
Write-Host "Run antivirus"
Push-Location "C:\Program Files\Windows Defender"
# Tell Defender to use 100% of the CPU during the scan
Set-MpPreference -ScanAvgCPULoadFactor 100
# Full Scan
.\MpCmdRun.exe -Scan -ScanType 2
Pop-Location
Update-MpSignature
Write-Host "Set antivirus parmeters"
Set-MpPreference -ScanAvgCPULoadFactor 5 `
-ExclusionPath "D:\", "C:\"

View File

@@ -1,18 +0,0 @@
################################################################################
## File: Validate-AnalysisExtenstion.ps1
## Desc: Validate Microsoft Analysis Services Projects Visual Studio extension
################################################################################
Import-Module -Name ImageHelpers -Force
#AnalysisPackage doesn't have any proper name in the state.packages.json file, only id is available
$AnalysisPackageVersion = Get-VS19ExtensionVersion -packageName "04a86fc2-dbd5-4222-848e-911638e487fe"
# Adding description of the software to Markdown
$SoftwareName = "Microsoft Analysis Services Projects Visual Studio Extension"
$Description = @"
_Version:_ $AnalysisPackageVersion<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -0,0 +1,22 @@
################################################################################
## File: Validate-SSDTExtensions.ps1
## Desc: Validate SQL Server Data Tools Visual Studio extensions
################################################################################
Import-Module -Name ImageHelpers -Force
#These extensions don't have any proper name in the state.packages.json file, only id is available, which can be found on extension marketplace download page
$AnalysisPackageVersion = Get-VSExtensionVersion -packageName "04a86fc2-dbd5-4222-848e-911638e487fe"
$IntegrationPackageVersion = Get-VSExtensionVersion -packageName "851E7A09-7B2B-4F06-A15D-BABFCB26B970"
$ReportingPackageVersion = Get-VSExtensionVersion -packageName "717ad572-c4b7-435c-c166-c2969777f718"
# Adding description of the software to Markdown
$SoftwareName = "Microsoft SSDT Visual Studio 2019 Extensions"
$Description = @"
_Microsoft Analysis Services Projects Version:_ $AnalysisPackageVersion<br/>
_SQL Server Integration Services Projects Version:_ $IntegrationPackageVersion<br/>
_Microsoft Reporting Services Projects Version:_ $ReportingPackageVersion<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description