Can anyone tell methe script to look for a file and if present add a registry.


Answer Summary:
0 Comments   [ + ] Show Comments


Please log in to comment

Answer Chosen by the Author

Try something like this, checking for the file is easy, writing the registry key is the pain in the ass bit unless you are using powershell 5, or you can take the easy way out and call reg.exe to write the key.

If ((Test-Path C:\TheFileYou\AreLookingFor.txt) -eq $true)
        {Write-Debug 'Write your registy key in this block'}
    Else{Write-Debug 'File not found.'}
Answered 06/09/2016 by: rileyz
Red Belt

  • Thank you!! It worked
Please log in to comment


if it is windows powershell scripting you can use a "IF Exists then or else command"

Answered 06/08/2016 by: SMal.tmcc
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity