Steps to reproduce
THIS ISSUE IS SPECIFIC TO POWERSHELL INSTALLED FROM THE WINDOWS STORE - THE MSI VERSION BEHAVES CORRECTLY
Example 1: create a registry entry using PowerShell and see if it can be accessed outside PowerShell
Create a new registry entry using New-ItemProperty
❯ New-ItemProperty -Path HKCU:\TESTKEY\ -Name Test1 -PropertyType Dword -Value 1
Test1 : 1
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\TESTKEY\
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER
PSChildName : TESTKEY
PSDrive : HKCU
PSProvider : Microsoft.PowerShell.Core\Registry
Using reg query does not show this entry in the registry:
Example 2: update an existing registry entry using PowerShell
Display the existing registry entry:
❯ reg query HKCU\TESTKEY
HKEY_CURRENT_USER\TESTKEY
Test2 REG_DWORD 0x1
Update the registry entry using Set-ItemProperty:
❯ Set-ItemProperty HKCU:\TESTKEY\ -Name Test2 -Value 5
Observe that reg query and Get-ItemProperty now display different values.
❯ reg query HKCU\TESTKEY
HKEY_CURRENT_USER\TESTKEY
Test2 REG_DWORD 0x1
❯ Get-ItemProperty -Path HKCU:\TESTKEY\
Test2 : 5
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\TESTKEY\
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER
PSChildName : TESTKEY
PSDrive : HKCU
PSProvider : Microsoft.PowerShell.Core\Registry
Example 3: delete an existing registry entry using PowerShell
Display the existing registry entry:
❯ reg query HKCU\TESTKEY
HKEY_CURRENT_USER\TESTKEY
Test3 REG_DWORD 0x4
❯ Get-ItemProperty HKCU:\TESTKEY\
Test3 : 4
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\TESTKEY\
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER
PSChildName : TESTKEY
PSDrive : HKCU
PSProvider : Microsoft.PowerShell.Core\Registry
Delete the entry using Remove-ItemProperty:
❯ Remove-ItemProperty -Path HKCU:\TESTKEY\ -Name Test3
Observe that reg query still shows the entry but Get-ItemProperty does not:
❯ reg query HKCU\TESTKEY\
HKEY_CURRENT_USER\TESTKEY
Test3 REG_DWORD 0x4
❯ Get-ItemProperty HKCU:\TESTKEY\
Expected behavior
Creating/editing/deleting registry entries should produce identical effects regardless of the tool used.
- Registry entries created using
New-ItemProperty should be visible outside PowerShell
- Updates to registry entries made using
Set-ItemProperty should be visible outside PowerShell
- Registry entries deleted using
Remove-ItemProperty should not be visible after deletion
Actual behavior
When using PowerShell installed from the Windows Store:
- Registry entries created using
New-ItemProperty are not visible outside PowerShell
- Changes made to registry entries using
Update-ItemProperty are not visible outside PowerShell
- Registry entries deleted using
Remove-ItemProperty are still visible outside PowerShell
When using the PowerShell installed via MSI, the actual behavior is correct.
Environment data
Name Value
---- -----
PSVersion 7.1.0
PSEdition Core
GitCommitId 7.1.0
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
Steps to reproduce
THIS ISSUE IS SPECIFIC TO POWERSHELL INSTALLED FROM THE WINDOWS STORE - THE MSI VERSION BEHAVES CORRECTLY
Example 1: create a registry entry using PowerShell and see if it can be accessed outside PowerShell
Create a new registry entry using
New-ItemPropertyUsing
reg querydoes not show this entry in the registry:Example 2: update an existing registry entry using PowerShell
Display the existing registry entry:
Update the registry entry using
Set-ItemProperty:Observe that
reg queryandGet-ItemPropertynow display different values.Example 3: delete an existing registry entry using PowerShell
Display the existing registry entry:
Delete the entry using
Remove-ItemProperty:Observe that
reg querystill shows the entry butGet-ItemPropertydoes not:Expected behavior
Creating/editing/deleting registry entries should produce identical effects regardless of the tool used.
New-ItemPropertyshould be visible outside PowerShellSet-ItemPropertyshould be visible outside PowerShellRemove-ItemPropertyshould not be visible after deletionActual behavior
When using PowerShell installed from the Windows Store:
New-ItemPropertyare not visible outside PowerShellUpdate-ItemPropertyare not visible outside PowerShellRemove-ItemPropertyare still visible outside PowerShellWhen using the PowerShell installed via MSI, the actual behavior is correct.
Environment data