Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create registry key that contains "/" [duplicate]

So I want to create a registry key in:

HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC2 128/128

How do I do this in PowerShell? I tried:

New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC2 128/128"

However PowerShell doesn't like the RC2 128/128 path bit. Its throwing a System ArgumentException.

like image 454
Anthony Avatar asked Dec 30 '25 06:12

Anthony


1 Answers

Assuming you're running .NET 4+, you can try using RegistryKey.CreateSubKey Method:

$key = [Microsoft.Win32.Registry]::LocalMachine.CreateSubKey('SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC2 128/128')
$key.Close()
Test-Path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC2 128/128' # => Should be `$true`

Needles to say, PowerShell must be running as Administrator to create a new key in HKLM.

like image 197
Santiago Squarzon Avatar answered Jan 01 '26 00:01

Santiago Squarzon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!