@@ -131,6 +131,9 @@ $global:issues = 0
131131
132132$global :isadmin = $null
133133
134+ $global :vswhere = ' '
135+ $global :vswhere_url = ' '
136+
134137$remove_any = ($RemoveAll -eq $true ) -or ($RemoveTestCert -eq $true ) -or ($RemoveTestCert -eq $true )
135138if (($remove_any -eq $false ) -And ($CheckTAEFService -eq $false ) -And ($StartTAEFService -eq $false ) -And
136139 ($StopTAEFService -eq $false ) -And ($CheckTestCert -eq $false ) -And ($CheckTestPfx -eq $false ) -And
@@ -300,10 +303,10 @@ function Get-VSWhereOnline
300303 {
301304 return $null
302305 }
303- $vswhere_url = ' https://github.com/microsoft/vswhere/releases/download/3.1.1 /vswhere.exe'
304- Write-Host " Downloading $vswhere from $vswhere_url ..."
305- Write-Verbose " Executing: curl.exe --output $vswhere -L -# $vswhere_url "
306- $null = Start-Process curl.exe - ArgumentList " --output $vswhere -L -# $vswhere_url " - Wait - NoNewWindow - PassThru
306+ $global : vswhere_url = ' https://github.com/microsoft/vswhere/releases/download/3.1.7 /vswhere.exe'
307+ Write-Host " Downloading $global : vswhere from $global : vswhere_url ..."
308+ Write-Verbose " Executing: curl.exe --output $path -L -# $global : vswhere_url "
309+ $null = Start-Process curl.exe - ArgumentList " --output $path -L -# $global : vswhere_url " - Wait - NoNewWindow - PassThru
307310
308311 }
309312 if (-not (Test-Path - Path $path - PathType Leaf))
@@ -314,8 +317,6 @@ function Get-VSWhereOnline
314317}
315318
316319# Home of vswhere.exe: https://github.com/microsoft/vswhere
317- $vswhere = ' '
318- $vswhere_url = ' '
319320function Get-VSWhere
320321{
321322 Write-Verbose " Detecting vswhere.exe..."
@@ -333,12 +334,11 @@ function Get-VSWhere
333334 if ([string ]::IsNullOrEmpty($global :vswhere ))
334335 {
335336 Write-Host " ERROR: vswhere.exe not found" - ForegroundColor Red - BackgroundColor Black
336- $global :issues += 1
337+ $global :issues ++
337338 return $null
338339 }
339340
340- Write-Verbose " Using $vswhere "
341- $global :vswhere = $vswhere
341+ Write-Verbose " Using $global :vswhere "
342342 return $global :vswhere
343343}
344344
@@ -370,18 +370,18 @@ function Run-Process([string]$exe, [string]$arguments, [Ref][string]$stderr, [in
370370 return $stdout
371371}
372372
373- $vspath = ' '
373+ $global : vspath = ' '
374374function Get-VisualStudio2022InstallPath
375375{
376376 Write-Verbose " Detecting VisualStudio 2022..."
377- $vswhere = Get-VSWhere
378- if ([string ]::IsNullOrEmpty($global :vswhere ))
377+ $vswhere_exe = Get-VSWhere
378+ if ([string ]::IsNullOrEmpty($vswhere_exe ))
379379 {
380380 return $null
381381 }
382382 $args = " -latest -products * -version [17.0,18.0) -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath"
383- Write-Verbose " Executing $vswhere $args "
384- $path = Run- Process $vswhere $args
383+ Write-Verbose " Executing $vswhere_exe $args "
384+ $path = Run- Process $vswhere_exe $args
385385 $path = $path -replace [environment ]::NewLine, ' '
386386 Write-Verbose " Visual Studio 2022 detected at $path "
387387 $global :vspath = $path
@@ -394,16 +394,16 @@ function Test-VisualStudioComponent
394394 [String ]$versionRange
395395 )
396396
397- $vswhere = Get-VSWhere
397+ $vswhere_exe = Get-VSWhere
398398 if ([string ]::IsNullOrEmpty($global :vswhere ))
399399 {
400400 return 0
401401 }
402402 $args = " -latest -products * -version $versionRange -requires $component -property productDisplayVersion"
403- Write-Verbose " Executing $vswhere $args "
403+ Write-Verbose " Executing $vswhere_exe $args "
404404 try
405405 {
406- $value = Run- Process $vswhere $args - throwIfExitCodeIsFailure $true
406+ $value = Run- Process $vswhere_exe $args - throwIfExitCodeIsFailure $true
407407 $path = $path -replace [environment ]::NewLine, ' '
408408 Write-Verbose " Visual Studio component $ ( $component ) = $ ( $value ) "
409409 return 0
@@ -456,6 +456,26 @@ function Test-VisualStudio2022Install
456456 return $ok
457457}
458458
459+ function Test-WindowsSDKInstall
460+ {
461+ param (
462+ [String ]$version
463+ )
464+
465+ $regkey = " HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\$version "
466+ $found = Test-Path $regkey - PathType Container
467+ if ($found )
468+ {
469+ Write-Verbose " Windows SDK $ ( $version ) = OK"
470+ }
471+ else
472+ {
473+ Write-Host " ...ERROR: Windows SDK $ ( $version ) not found or valid. See [Getting Started doc's Tooling Prerequisites](https://github.com/microsoft/WindowsAppSDK/blob/main/docs/Coding-Guidelines/GettingStarted.md#tooling-prerequisites)" - ForegroundColor Red - BackgroundColor Black
474+ $global :issues ++
475+ }
476+ return $found
477+ }
478+
459479function Test-DevTestPfx
460480{
461481 if ($Clean -eq $true )
@@ -468,7 +488,7 @@ function Test-DevTestPfx
468488 if (-not (Test-Path - Path $pfx_thumbprint - PathType Leaf))
469489 {
470490 Write-Host " Test certificate thumbprint $pfx_thumbprint ...Not Found"
471- $global :issues += 1
491+ $global :issues ++
472492 return $false
473493 }
474494
@@ -477,7 +497,7 @@ function Test-DevTestPfx
477497 if (-not (Test-Path - Path $cert_path ))
478498 {
479499 Write-Host " Test certificate for $pfx_thumbprint ...Not Found"
480- $global :issues += 1
500+ $global :issues ++
481501 return $false
482502 }
483503
@@ -487,13 +507,13 @@ function Test-DevTestPfx
487507 if ($expiration -lt $now )
488508 {
489509 Write-Host " Test certificate for $pfx_thumbprint ...Expired ($expiration )"
490- $global :issues += 1
510+ $global :issues ++
491511 return $false
492512 }
493513 elseif ($expiration -lt ($now + (New-TimeSpan - Days 14 )))
494514 {
495515 Write-Host " Test certificate for $pfx_thumbprint ...Expires soon ($expiration )"
496- $global :issues += 1
516+ $global :issues ++
497517 return $true
498518 }
499519
@@ -507,7 +527,7 @@ function Repair-DevTestPfx
507527 if ($isadmin -eq $false )
508528 {
509529 Write-Host " Test certificate .pfx...Access Denied. Run from an admin prompt"
510- $global :issues += 1
530+ $global :issues ++
511531 return $false
512532 }
513533
@@ -526,7 +546,7 @@ function Repair-DevTestPfx
526546 if (-not (Test-Path - Path $CertPasswordFile - PathType Leaf))
527547 {
528548 Write-Host " Test certificate file $CertPasswordFile ...Not Found"
529- $global :issues += 1
549+ $global :issues ++
530550 return $false
531551 }
532552 $password = Get-Content - Path $CertPasswordFile - Encoding utf8
@@ -542,7 +562,7 @@ function Repair-DevTestPfx
542562 if ([string ]::IsNullOrEmpty($password_plaintext ))
543563 {
544564 Write-Host " Test certificate .pfx...password parameter (-CertPassword | -CertPasswordFile | -CertPasswordUser) or prompting required"
545- $global :issues += 1
565+ $global :issues ++
546566 return $false
547567 }
548568 $password = ConvertTo-SecureString - String $password_plaintext - Force - AsPlainText
@@ -589,7 +609,7 @@ function Repair-DevTestPfx
589609 else
590610 {
591611 Write-Host " Create $f ...Error"
592- $global :issues += 1
612+ $global :issues ++
593613 $ok = $false
594614 }
595615 }
@@ -626,7 +646,7 @@ function Test-DevTestCert
626646 if (-not (Test-Path - Path $cert_path ))
627647 {
628648 Write-Host " Test certificate $pfx_thumbprint thumbprint $thumbprint ...Not Found"
629- $global :issues += 1
649+ $global :issues ++
630650 return $false
631651 }
632652
@@ -636,13 +656,13 @@ function Test-DevTestCert
636656 if ($expiration -lt $now )
637657 {
638658 Write-Host " Test certificate $thumbprint ...Expired ($expiration )"
639- $global :issues += 1
659+ $global :issues ++
640660 return $false
641661 }
642662 elseif ($expiration -lt ($now + (New-TimeSpan - Days 14 )))
643663 {
644664 Write-Host " Test certificate $thumbprint ...Expires soon ($expiration )"
645- $global :issues += 1
665+ $global :issues ++
646666 return $false
647667 }
648668
@@ -656,7 +676,7 @@ function Repair-DevTestCert
656676 if ($isadmin -eq $false )
657677 {
658678 Write-Host " Install test certificate...Access Denied. Run from an admin prompt"
659- $global :issues += 1
679+ $global :issues ++
660680 return
661681 }
662682
@@ -677,7 +697,7 @@ function Remove-DevTestCert
677697 if ($isadmin -eq $false )
678698 {
679699 Write-Host " Remove test certificate...Access Denied. Run from an admin prompt"
680- $global :issues += 1
700+ $global :issues ++
681701 return $false
682702 }
683703
@@ -796,7 +816,7 @@ function Install-TAEFService
796816 if ($isadmin -eq $false )
797817 {
798818 Write-Host " Install TAEF service...Access Denied. Run from an admin prompt"
799- $global :issues += 1
819+ $global :issues ++
800820 return
801821 }
802822
@@ -808,7 +828,7 @@ function Install-TAEFService
808828 if (-not (Test-Path - Path $path - PathType Leaf))
809829 {
810830 Write-Host " Install TAEF service...Not Found ($path )"
811- $global :issues += 1
831+ $global :issues ++
812832 return ' TAEFNotFound'
813833 }
814834
@@ -818,7 +838,7 @@ function Install-TAEFService
818838 if ([string ]::IsNullOrEmpty($service ))
819839 {
820840 Write-Host " Install TAEF service...Failed"
821- $global :issues += 1
841+ $global :issues ++
822842 return ' InstallError'
823843 }
824844 else
@@ -834,7 +854,7 @@ function Uninstall-TAEFService
834854 if ($isadmin -eq $false )
835855 {
836856 Write-Host " Uninstall TAEF service...Access Denied. Run from an admin prompt"
837- $global :issues += 1
857+ $global :issues ++
838858 return
839859 }
840860
@@ -851,7 +871,7 @@ function Uninstall-TAEFService
851871 if (-not ([string ]::IsNullOrEmpty($service )))
852872 {
853873 Write-Host " Uninstall TAEF service...Failed"
854- $global :issues += 1
874+ $global :issues ++
855875 return ' UninstallError'
856876 }
857877 else
@@ -867,7 +887,7 @@ function Start-TAEFService
867887 if ($isadmin -eq $false )
868888 {
869889 Write-Host " Install TAEF service...Access Denied. Run from an admin prompt"
870- $global :issues += 1
890+ $global :issues ++
871891 return
872892 }
873893
@@ -876,7 +896,7 @@ function Start-TAEFService
876896 if ($service.Status -ne " Running" )
877897 {
878898 Write-Host " Start TAEF service...Failed"
879- $global :issues += 1
899+ $global :issues ++
880900 }
881901 else
882902 {
@@ -891,7 +911,7 @@ function Stop-TAEFService
891911 if ($isadmin -eq $false )
892912 {
893913 Write-Host " Stop TAEF service...Access Denied. Run from an admin prompt"
894- $global :issues += 1
914+ $global :issues ++
895915 return $false
896916 }
897917
@@ -912,7 +932,7 @@ function Stop-TAEFService
912932 elseif ($service.Status -ne " Stopped" )
913933 {
914934 Write-Host " Stop TAEF service...Failed"
915- $global :issues += 1
935+ $global :issues ++
916936 return $false
917937 }
918938 else
@@ -1334,6 +1354,7 @@ if (($CheckAll -ne $false) -Or ($CheckVisualStudio -ne $false))
13341354 {
13351355 $null = Test-VisualStudioComponents
13361356 }
1357+ $null = Test-WindowsSDKInstall ' 10.0.17763.0'
13371358}
13381359
13391360if (($CheckAll -ne $false ) -Or ($CheckTestPfx -ne $false ))
0 commit comments