Change Registry Using Params in powershell

param (
   
   [string]  $userName = "UserName",
   [Parameter(Mandatory=$true)] [string] $value = "SecretPassword"
   
)

$registryPath = "HKLM:\SOFTWARE\WOW6432Node\TESTAPP"
IF(!(Test-Path $registryPath))

  {

    New-Item -Path $registryPath -Force | Out-Null
    New-ItemProperty -Path $registryPath -Name $userName -PropertyType 'String' -value $value

}

 ELSE {
    New-ItemProperty -Path $registryPath -Name $userName -Value $value -PropertyType 'String' -Force | Out-Null

 }