Changed usage of registry to psdrive instead of type which causes failure on Linux (#3377)
This commit is contained in:
parent
0e12fbfc9e
commit
d59a71f82c
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue