In this blog post, you will learn how to use a PowerShell script to install all the necessary software prerequisites on the SCVMM management server when deploying System Center Virtual Machine Manager (SCVMM) 2022.
Before you can start the SCVMM installation on your management server, in addition to the hardware prerequisites, it’s essential to install certain software requirements. These requirements are listed below:
- Visual C++ Redistributable (x86)
- Visual C++ Redistributable (x64)
- ODBC Driver for SQL Server
- Microsoft Command Line Utilities 15 for SQL Server
- Windows ADK
- WinPE Addon for Windows ADK
To automate the deployment process of all these SCVMM required software prerequisites, I wrote the following PowerShell script. This script includes the following steps and configurations:
- Check if PowerShell runs as Administrator, otherwise, exit the script.
- Create the C:\Temp folder if it does not already exist.
- Download all .exe and .msi files to the C:\Temp folder.
- Install Microsoft Visual C++ Redistributable.
- Install ODBC Driver for SQL Server.
- Install Microsoft Command Line Utilities 15 for SQL Server.
- Install Windows Assessment and Deployment Kit (ADK).
- Install WinPE Addon for Windows ADK.
- Clean up all .exe and .msi files in the C:\Temp folder.
- Write script completed, and a server reboot will take place.
To use the script, first make a copy and save it as “Configure-SCVMM-software-prerequisites.ps1,” or you can download it directly from GitHub. Afterward, execute the script either from a Windows PowerShell session on a management server or directly on your SCVMM management server.
Prerequisites
- A virtual machine (VM) or physical server running Windows Server 2022 to serve as your SCVMM management server.
- A management server with Internet access. If you intend to deploy the script directly from your SCVMM management server, ensure that it also has Internet access.
PowerShell script
In my example, I executed the script directly on the SCVMM management server. To achieve this, I logged in to the server using an administrator account and then copied the script.
Afterwards, I executed the script from an elevated Windows PowerShell window.
Please note that the SCVMM management server will automatically reboot once the script finishes to complete the installation of all the new software components.
.\Configure-SCVMM-software-prerequisites
<#
.SYNOPSIS
A script used for configuring the required software prerequisites to set up an SCVMM management server (2022).
.DESCRIPTION
A script used for configuring the required software prerequisites to set up an SCVMM management server (2022).
This script will do all of the following:
Check if PowerShell runs as Administrator, otherwise, exit the script.
Create the C:\Temp folder if it does not already exist.
Download all .exe and .msi files to the C:\Temp folder.
Install Microsoft Visual C++ Redistributable.
Install ODBC Driver for SQL Server.
Install Microsoft Command Line Utilities 15 for SQL Server.
Install Windows Assessment and Deployment Kit (ADK).
Install WinPE Addon for Windows ADK.
Clean up all .exe and .msi files in the C:\Temp folder.
Write script completed, and a server reboot will take place.
.NOTES
Filename: Configure-SCVMM-software-prerequisites.ps1
Created: 28/08/2023
Last modified: 28/08/2023
Author: Wim Matthyssen
Version: 1.0
PowerShell: 5.1
Action: Change variables were needed to fit your needs.
Disclaimer: This script is provided "As Is" with no warranties.
.EXAMPLE
.\Configure-SCVMM-software-prerequisites.ps1
.LINK
https://wmatthyssen.com/2022/06/03/azure-arc-azure-powershell-prerequisites-configuration-script/
#>
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Variables
$tempFolderName = "Temp"
$tempFolder = "C:\" + $tempFolderName +"\"
$itemType = "Directory"
$visualC2017x86Url = "https://aka.ms/vs/17/release/vc_redist.x86.exe"
$visualC2017x86Exe = $tempFolder + "VC_redist.x86.exe"
$visualC2017x64Url = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
$visualC2017x64Exe = $tempFolder + "VC_redist.x64.exe"
$msodbcsqlUrl = "https://go.microsoft.com/fwlink/?linkid=2239168"
$msodbcsqlMsi = $tempFolder + "msodbcsql.msi"
$msSqlCmdLnUtilsUrl = "https://go.microsoft.com/fwlink/?linkid=2230791"
$msSqlCmdLnUtilsMsi = $tempFolder + "MsSqlCmdLnUtils.msi"
$adkUrl = "https://go.microsoft.com/fwlink/?linkid=2196127"
$adkExe = $tempFolder + "adksetup.exe"
$adkWinPeUrl = "https://go.microsoft.com/fwlink/?linkid=2196224"
$adkWinPeExe = $tempFolder + "adkwinpesetup.exe"
Set-PSBreakpoint -Variable currenttime -Mode Read -Action {$global:currenttime = Get-Date -Format "dddd MM/dd/yyyy HH:mm"} | Out-Null
$foregroundColor1 = "Green"
$foregroundColor2 = "Yellow"
$foregroundColor3 = "Red"
$writeEmptyLine = "`n"
$writeSeperatorSpaces = " - "
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Check if PowerShell runs as Administrator, otherwise, exit the script
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$isAdministrator = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
# Check if running as Administrator, otherwise exit the script
if ($isAdministrator -eq $false) {
Write-Host ($writeEmptyLine + "# Please run PowerShell as Administrator" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor3 $writeEmptyLine
Start-Sleep -s 3
exit
} else {
Write-Host ($writeEmptyLine + "# Script started. Without any errors, it will need around 2 minutes to complete" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor1 $writeEmptyLine
}
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Create the C:\Temp folder if it does not already exist
If(!(test-path $tempFolder))
{
New-Item -Path "C:\" -Name $tempFolderName -ItemType $itemType -Force | Out-Null
}
Write-Host ($writeEmptyLine + "# $tempFolderName folder available" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor2 $writeEmptyLine
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Download all .exe and .msi files to the C:\Temp folder
Invoke-WebRequest -Uri $visualC2017x86Url -OutFile $visualC2017x86Exe
Invoke-WebRequest -Uri $visualC2017x64Url -OutFile $visualC2017x64Exe
Invoke-WebRequest -Uri $msodbcsqlUrl -OutFile $msodbcsqlMsi
Invoke-WebRequest -Uri $msSqlCmdLnUtilsUrl -OutFile $msSqlCmdLnUtilsMsi
Invoke-WebRequest -Uri $adkUrl -OutFile $adkExe
Invoke-WebRequest -Uri $adkWinPeUrl -OutFile $adkWinPeExe
$visualC2017x86Url = "https://aka.ms/vs/17/release/vc_redist.x86.exe"
$visualC2017x86Exe = $tempFolder + "VC_redist.x86.exe"
Write-Host ($writeEmptyLine + "# All .exe and .msi files are available in the $tempFolderName folder" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor2 $writeEmptyLine
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Install Microsoft Visual C++ Redistributable (x86)
Start-Process -Wait -FilePath $visualC2017x86Exe -ArgumentList '/S','/v','/qn' -passthru | Out-Null
Write-Host ($writeEmptyLine + "# Microsoft Visual C++ Redistributable installed" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor2 $writeEmptyLine
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Install Microsoft Visual C++ Redistributable (x64)
Start-Process -Wait -FilePath $visualC2017x64Exe -ArgumentList '/S','/v','/qn' -passthru | Out-Null
Write-Host ($writeEmptyLine + "# Microsoft Visual C++ Redistributable installed" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor2 $writeEmptyLine
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Install ODBC Driver for SQL Server
Start-Process msiexec.exe -Wait -ArgumentList '/i "C:\Temp\msodbcsql.msi" /qb IACCEPTMSODBCSQLLICENSETERMS=YES /quiet'
Write-Host ($writeEmptyLine + "# ODBC Driver for SQL Server installed" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor2 $writeEmptyLine
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Install Microsoft Command Line Utilities 15 for SQL Server
Start-Process msiexec.exe -Wait -ArgumentList '/i "C:\Temp\MsSqlCmdLnUtils.msi" IACCEPTMSSQLCMDLNUTILSLICENSETERMS=YES /qb /quiet'
Write-Host ($writeEmptyLine + "# Microsoft Command Line Utilities 15 for SQL Server installed" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor2 $writeEmptyLine
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Install Windows Assessment and Deployment Kit (ADK)
$setupSwitchesAdk = "/Features OptionId.DeploymentTools /norestart /quiet /ceip off"
Start-Process -FilePath $adkExe -ArgumentList $setupSwitchesAdk -NoNewWindow -Wait
Write-Host ($writeEmptyLine + "# Windows Assessment and Deployment Kit (ADK) installed" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor2 $writeEmptyLine
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Install WinPE Addon for Windows ADK
$setupSwitchesPe = "/Features OptionId.WindowsPreinstallationEnvironment /norestart /quiet /ceip off"
Start-Process -FilePath $adkWinPeExe -ArgumentList $setupSwitchesPe -NoNewWindow -Wait
Write-Host ($writeEmptyLine + "# WinPE Addon for Windows ADK installed" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor2 $writeEmptyLine
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Clean up all .exe and .msi files in the C:\Temp folder
Remove-Item -Path $visualC2017x86Exe
Remove-Item -Path $visualC2017x64Exe
Remove-Item -Path $msodbcsqlMsi
Remove-Item -Path $msSqlCmdLnUtilsMsi
Remove-Item -Path $adkExe
Remove-Item -Path $adkWinPeExe
Write-Host ($writeEmptyLine + "# All .exe and .msi files are cleaned up in the $tempFolderName folder" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor1 $writeEmptyLine
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Write script completed, and a server reboot will take place
Write-Host ($writeEmptyLine + "# The script has finished running, and now a server reboot is being initiated to implement all the changes" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor1 $writeEmptyLine
# Wait 3 seconds and then restart the server
Start-Sleep 3
Restart-Computer -ComputerName localhost
## ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
After the reboot, you can verify the successful installation of all the necessary software components. If everything is in order, you can proceed with your SCVMM deployment.
Conclusion
Using the power of automation through PowerShell scripts can significantly streamline the process of configuring the essential software and other prerequisites for SCVMM 2022.
I hope the PowerShell script is useful for you and provides you with a good starting point for implementing SCVMM 2022 in your on-premises environment.
Should you have any questions or suggestions regarding the script, feel free to reach out to me through my Twitter handle (@wmatthyssen) or simply leave a comment, and I’ll be more than happy to assist.
0 comments on “Configure SCVMM 2022 required software prerequisites with a PowerShell script”