Skip to content

Test-Path does not work as expected on PowerShell 7.1.4 for a particular registry key #16072

@schiroky

Description

@schiroky

Prerequisites

Steps to reproduce

As a prerequisite ensure to have the Azure Information Protection client installed and configured.
With that a particular registry key will be created:
[HKCU:\Software\Classes\Local Settings\Software\Microsoft\MSIPC]

Try to check for this key with the command:

PS C:\Windows\System32> Test-Path -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\MSIPC"

Expected behavior

As a result, you should see (on PowerShell 7.1.4.0 x64):

PS C:\Windows\System32> True

Actual behavior

But instead on PowerShell 7.1.4.0 x64 it returns:

PS C:\Windows\System32> False

Error details

In fact the key exist for sure. When checking the key with PowerShell 5.1, I always get the correct value returned:

PS C:\Windows\System32> True

I have created my own folder under the corresponding sub-key, and checking this is working. So at first we believed it must be related to the folder or it's settings. Nevertheless, why it works with PowerShell 5.1. Something seems to block 7.1 from reading this key.
Comparing a working and non-working folder does not show any differences. I also collaborated with an engineer from our AIP security team (responsible for the AIP client), but we did not find a difference.

Could you please check and assist finding a work around or the cause of this problem, or even better a solution?

Environment data

Name                           Value
----                           -----
PSVersion                      7.1.4
PSEdition                      Core
GitCommitId                    7.1.4
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-AnsweredThe question is answered.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions