create regkey | creating 2 keys instead of one

Welcome Forums General PowerShell Q&A create regkey | creating 2 keys instead of one

This topic contains 1 reply, has 2 voices, and was last updated by

1 year, 6 months ago.

  • Author
  • #77757

    Points: 0
    Rank: Member

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

    [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\SecurityProviders\SCHANNEL\Ciphers\AES 128/128]

    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

    Points: 1,086
    Helping Hand
    Rank: Community Hero

    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 }

The topic ‘create regkey | creating 2 keys instead of one’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort