I'm working on a PowerShell script to install the Oracle client 19c. One of the things I need to do in the script before the install starts is to remove an environment variable from the Windows registry. This is the command I am using in the script to do this:
Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name "ORACLE_BASE" -Force
The problem is when the install starts later in the script it still thinks that setting is there, even though after the script is done running the setting is no longer there when I look. So I'm thinking I need to run that command in a special instance or something so it takes effect right away. Just not sure the best way to do that. I've tried using both start-process and invoke-expression to launch powershell within the script and neither method seems to do the trick. Any help would be much appreciated!
ORACLE_BASEenvironment variable is defined when you start the install?cmd.exeor PowerShell shell).