Forum Discussion

svetlozar's avatar
svetlozar
Copper Contributor
Jul 03, 2021

Changing / creating reg values

Hi all,

 

I am new to PowerShell and I am writing scripts to check and configure some security settings of MS Office.

 

I have managed to write the following, but it gives me an error when trying to create a hierarchy of a registry key. If I use -Force it will overwrite the existing data in a key, which I aim to avoid.

 

Looking forward to hearing from you.

1 Reply

  • yuzoyox's avatar
    yuzoyox
    Iron Contributor
    Hi Svetzolar, try to use cmd command instead powershell
    reg add $path /v $regname /t REG_DWORD /d 1 /f

    maybe it will work.
    Thank you very much
    Regards

Resources