-
Notifications
You must be signed in to change notification settings - Fork 1
/
add_ssms.ps1
26 lines (20 loc) · 951 Bytes
/
add_ssms.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function Write-Log {
param (
$message
)
$formattedTime = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
Write-Host "$formattedTime init_vm: $message"
}
$BUILD_DIRECTORY="C:\BuildArtifacts"
$INSTALL_DIRECTORY="C:\Software\SSMStools"
$SSMS_INSTALLER_FILE="SSMS-Setup-ENU.exe"
$SSMS_DOWNLOAD_URL="https://aka.ms/ssmsfullsetup"
$SSMS_INSTALL_ARGS="/INSTALL /QUIET SSMSInstallRoot=$INSTALL_DIRECTORY /norestart"
# Write-Log "Downloading SSMS installer"
Invoke-WebRequest $SSMS_DOWNLOAD_URL -OutFile $BUILD_DIRECTORY\$SSMS_INSTALLER_FILE
Write-Log "Installing SSMS"
Start-Process "$BUILD_DIRECTORY\$SSMS_INSTALLER_FILE" -ArgumentList $SSMS_INSTALL_ARGS -Wait
Write-Log "Add SSMS Desktop Shortcut"
$ALL_USER_DESKTOP=[Environment]::GetFolderPath('CommonDesktopDirectory')
New-Item -ItemType SymbolicLink -Path "$ALL_USER_DESKTOP\SSMS.lnk" -Target "$SSMS_INSTALL_DIRECTORY\Common7\IDE\Ssms.exe"
Write-Log "add_ssms script completed"