none
Crate a Registry D word on remote servers if not exists.. RRS feed

  • General discussion

  • Hi

    I want create Registry d word with specific value if not exist...I am using below script and it is working as excepted..

    My requirement is update on Remote servers..can some one please give me clue  

    #############################################

    $registryPath = "HKCU:\Software\ScriptingGuys\Scripts"

    $Name = "Version"

    $value = "0"


    IF(!(Test-Path $registryPath))



      {

      Write-Host "Regvalue not exists creating..please wait"


     New-Item -Path $registryPath -Force | Out-Null

      New-ItemProperty -Path $registryPath -Name $name -Value $value `    -PropertyType DWORD -Force | Out-Null


      }



     ELSE {

      Write-Host "Regvalue  exists  No action required creating..please wait"

        New-ItemProperty -Path $registryPath -Name $name -Value $value `  -PropertyType DWORD -Force | Out-Null}

    ###########################################################################

    • Changed type Bill_Stewart Tuesday, November 7, 2017 9:47 PM
    • Moved by Bill_Stewart Tuesday, November 7, 2017 9:47 PM Help vampire
    Sunday, September 17, 2017 12:40 PM

All replies