ps/Modules/Alkami.PowerShell.SDK/Public/Confirm-Software.ps1

69 lines
2.3 KiB
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Confirm-Software() {
[CmdletBinding()]
param ()
# Check for Visual Studio 2019 or 2022
if (Test-Path -Path "C:\ProgramData\Microsoft\VisualStudio") {
$vsInstalled = $false
$vsInstances = Get-CimInstance MSFT_VSInstance
$output = ""
foreach ($vsInstance in $vsInstances) {
$splits = $vsInstance.Version.Split('.')
$version += $splits[0]
if ($version -ge 16) {
$vsInstalled = $true
}
$output += "$($vsInstance.ElementName) is installed.`n"
}
if ($vsInstalled) {
Write-Host $output.Substring(0,$output.Length-2)
} else {
$output += "Visual Studio 2019 or higher is NOT installed. Please install before continuing SDK installation."
Write-Host $output
}
} else {
Write-Host "Visual Studio is NOT installed. Please install before continuing SDK installation.";
}
# Check for an SQL Server Instance and verify that it is v15 (2019) or higher
$sqlVersions = Get-InstalledSQLVersions
$sqlInstalled = $false
foreach ($sqlVersion in $sqlVersions) {
$splits = $sqlVersion.Split('.')
$version += $splits[0]
if ($version -ge 15) {
$sqlInstalled = $true
}
}
if ($sqlInstalled) {
Write-Host "Microsoft SQL Server v$sqlVersion is installed."
} else {
Write-Host "Microsoft SQL Server 2019 or greater is NOT installed. Please install before continuing SDK installation."
}
$softwarePackages = @("7-Zip","SQL Server Management Studio","Notepad\+\+");
foreach ($softwarePackage in $softwarePackages) {
$installed = ((gp HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*).DisplayName -Match $softwarePackage).Length -gt 0
If(-Not $installed) {
Write-Host "$($softwarePackage.Replace('\','')) is NOT installed. Please install before continuing SDK installation.";
} else {
Write-Host "$($softwarePackage.Replace('\','')) is installed."
}
}
$chocolateyPath = "C:\ProgramData\chocolatey"
$nugetCmdLinePath = "C:\ProgramData\chocolatey\lib\NuGet.CommandLine"
if (Test-Path -Path $chocolateyPath) {
Write-Host "Chocolatey is installed"
} else {
Write-Host "Chocolatey is NOT installed. Please install before continuing SDK installation"
}
if (Test-Path -Path $nugetCmdLinePath) {
Write-Host "NuGet Command Line is installed"
} else {
Write-Host "NuGet Command Line is NOT installed. Please install before continuing SDK installation"
}
}