Skip to content

Instantly share code, notes, and snippets.

@MartinMiles
Created September 16, 2019 18:46
Show Gist options
  • Save MartinMiles/615ebcc2eaa5dadade9c4e04a3cb9d3d to your computer and use it in GitHub Desktop.
Save MartinMiles/615ebcc2eaa5dadade9c4e04a3cb9d3d to your computer and use it in GitHub Desktop.
Verifies if .NET Core is installed on the machine
$DotNETCoreUpdatesPath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Updates\.NET Core"
$DotNetCoreItems = Get-Item -ErrorAction Stop -Path $DotNETCoreUpdatesPath
$NotInstalled = $True
$DotNetCoreItems.GetSubKeyNames() | Where { $_ -Match "Microsoft .NET Core.*Windows Server Hosting" } | ForEach-Object {
$NotInstalled = $False
Write-Host "The host has installed $_"
}
If ($NotInstalled) {
Write-Host "Can not find ASP.NET Core installed on the host"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment