create regkey | creating 2 keys instead of one

This topic contains 1 reply, has 2 voices, and was last updated by  Olaf Soyk 1 month ago.

  • Author
    Posts
  • #77757

    H Man
    Participant

    I am trying to reproduce this key , here is the .reg example

    [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\SecurityProviders\SCHANNEL\Ciphers\AES 128/128]
    "Enabled"=dword:ffffffff

    In powershell I am trying this

    if((Test-Path "HKLM:\SYSTEM\ControlSet001\Control\SecurityProviders\SCHANNEL\Ciphers\AES 128/128") -ne $true) {  New-Item "HKLM:\SYSTEM\ControlSet001\Control\SecurityProviders\SCHANNEL\Ciphers\AES 128/128" -force -ea SilentlyContinue -Verbose };

    Instead of creating one key like "HKLM:\SYSTEM\ControlSet001\Control\SecurityProviders\SCHANNEL\Ciphers\AES 128/128"
    its creating 2 keys like this
    HKLM:\SYSTEM\ControlSet001\Control\SecurityProviders\SCHANNEL\Ciphers\AES 128" with a sub key of 128. I think the / character is causing this .

    Any help would be greatly appreciated !

  • #77841

    Olaf Soyk
    Participant

    Try it this way:

    if(-not (Test-Path 'HKLM:\SYSTEM\ControlSet001\Control\SecurityProviders\SCHANNEL\Ciphers\AES 128/128')) {  New-Item 'HKLM:\SYSTEM\ControlSet001\Control\SecurityProviders\SCHANNEL\Ciphers\AES 128/128' -Force -ErrorAction SilentlyContinue -Verbose }

You must be logged in to reply to this topic.