'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.
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Santiago Squarzon |
