diff --git a/test/powershell/engine/Help/HelpSystem.OnlineHelp.Tests.ps1 b/test/powershell/engine/Help/HelpSystem.OnlineHelp.Tests.ps1 index e3b469f01..914760e0b 100644 --- a/test/powershell/engine/Help/HelpSystem.OnlineHelp.Tests.ps1 +++ b/test/powershell/engine/Help/HelpSystem.OnlineHelp.Tests.ps1 @@ -52,24 +52,23 @@ Describe 'Get-Help -Online opens the default web browser and navigates to the cm if((-not ($skipTest)) -and $IsWindows) { $skipTest = $true - $regKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" + $regKey = "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" try { - $progId = [Microsoft.Win32.Registry]::GetValue($regKey, "ProgId", $null) + $progId = (Get-ItemProperty $regKey).ProgId if($progId) { - $browserKey = [Microsoft.Win32.Registry]::ClassesRoot.OpenSubKey("$progId\shell\open\command", $false) - if($browserKey) + if ((Get-PSDrive -Name HKCR) -eq $Null) { - $browserExe = ($browserKey.GetValue($null) -replace '"', '') -split " " - - if ($browserExe.count -ge 1) + New-PSDrive -PSProvider registry -Root HKEY_CLASSES_ROOT -Name HKCR | Should NotBeNullOrEmpty + } + $browserExe = ((Get-ItemProperty "HKCR:\$progId\shell\open\command")."(default)" -replace '"', '') -split " " + if ($browserExe.count -ge 1) + { + if($browserExe[0] -match '.exe') { - if($browserExe[0] -match '.exe') - { - $skipTest = $false - } + $skipTest = $false } } }