move mms provisioner scripts

This commit is contained in:
Dibir Magomedsaygitov
2020-09-29 18:13:37 +03:00
parent 7ac332bcc0
commit bac163a71b
6 changed files with 100 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
# Add well-known SSH host keys to ssh_known_hosts
ssh-keyscan -t rsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts"
ssh-keyscan -t dsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts"

View File

@@ -0,0 +1,30 @@
# Create Rust junction points to cargo and rustup folder
$cargoTarget = "$env:USERPROFILE\.cargo"
if (-not (Test-Path $cargoTarget))
{
New-Item -ItemType Junction -Path $cargoTarget -Target "C:\Rust\.cargo"
if (Test-Path $cargoTarget)
{
Write-Host "Junction created for $cargoTarget <<===>> C:\Rust\.cargo"
}
else
{
Write-Host "Junction was not created for $cargoTarget"
}
}
$rustupTarget = "$env:USERPROFILE\.rustup"
if (-not (Test-Path $rustupTarget))
{
New-Item -ItemType Junction -Path $rustupTarget -Target "C:\Rust\.rustup"
if (Test-Path $rustupTarget)
{
Write-Host "Junction created for $rustupTarget <<===>> C:\Rust\.rustup"
}
else
{
Write-Host "Junction was not created for $rustupTarget"
}
}

View File

@@ -0,0 +1,9 @@
# Script to address any current issues with images that could be easily worked around.
$ErrorActionPreference="Stop"
# Remove 3 registry settings that are left behind when sysprepping. Having those registry settings together with a
# race condition that kicks in when trying to run custom scripts extensions and stops us from reimaging machines.
# ICM: https://portal.microsofticm.com/imp/v3/incidents/details/191973270/home
Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'Incarnation' -Force -ErrorAction Ignore
Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'InVmSvdSeqNo' -Force -ErrorAction Ignore
Remove-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState' -Name 'LastGoalStateMethod' -Force -ErrorAction Ignore

View File

@@ -0,0 +1,14 @@
if ([string]::IsNullOrEmpty($env:RUNNER_TOOL_CACHE))
{
$env:RUNNER_TOOL_CACHE=$env:AGENT_TOOLSDIRECTORY
[System.Environment]::SetEnvironmentVariable('RUNNER_TOOL_CACHE', $env:AGENT_TOOLSDIRECTORY, [System.EnvironmentVariableTarget]::Machine)
Write-Host "RUNNER_TOOL_CACHE set to match AGENT_TOOLSDIRECTORY: $env:RUNNER_TOOL_CACHE"
[System.Environment]::SetEnvironmentVariable('AGENT_TOOLSDIRECTORY', $null, [System.EnvironmentVariableTarget]::Machine)
$isAgentToolsDirectoryNotThere = [string]::IsNullOrEmpty($env:RUNNER_TOOL_CACHE)
Write-Host "AGENT_TOOLSDIRECTORY deleted: $isAgentToolsDirectoryNotThere"
}
else
{
Write-Host "RUNNER_TOOL_CACHE non-empty: $env:RUNNER_TOOL_CACHE"
}

View File

@@ -0,0 +1,4 @@
$vsInstallRoot = Get-VisualStudioPath
$devEnvPath = "$vsInstallRoot\Common7\IDE\devenv.exe"
cmd.exe /c "`"$devEnvPath`" /updateconfiguration"

View File

@@ -0,0 +1,39 @@
$isPathUpdated = $false
$hgPath = "$Env:ProgramFiles\Mercurial\"
$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
if (Test-Path -Path $hgPath)
{
$latestPath = "$hgPath;$latestPath"
Write-Host "Added Mercurial to PATH"
$isPathUpdated = $true
}
else
{
Write-Host "Didn't find Mercurial at $hgPath. Skipping adding PATH to it."
}
$dotnetPath = "$env:USERPROFILE\.dotnet\tools"
if ($latestPath.Contains("C:\Users\VssAdministrator\.dotnet\tools"))
{
$latestPath = $latestPath.Replace("C:\Users\VssAdministrator\.dotnet\tools", "$dotnetPath")
$isPathUpdated = $true
}
if (-not $latestPath.Contains($dotnetPath))
{
$latestPath = "$dotnetPath;$latestPath"
Write-Host "Added .dotnet\tools $dotnetPath to PATH"
$isPathUpdated = $true
}
else
{
Write-Host "$dotnetPath already in PATH"
}
if ($isPathUpdated)
{
[System.Environment]::SetEnvironmentVariable('PATH', $latestPath, [System.EnvironmentVariableTarget]::Machine)
}
$updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
Write-Host "Windows PATH: $updatedPath"