Need help to run a powershell userdata script as administrator during the start up of instance.
sample code i used is
<powershell>
net.exe session 1>NUL 2>NUL || (powershell "Start-Process -FilePath Cmd.exe -ArgumentList \"/c %~dpnx0\" -Verb RunAs" & goto :eof)
cd c:/
Write-Output "creating required directories"
mkdir test
mkdir logs
[System.Environment]::SetEnvironmentVariable('JAVA_HOME', 'C:\Program Files\Zulu\zulu-8', [System.EnvironmentVariableTarget]::Machine)
[System.Environment]::SetEnvironmentVariable('LOG_APPENDER', 'json', [System.EnvironmentVariableTarget]::Machine)
</powershell>
<persist>true</persist>
I added and
I was hoping this will help to run script as administrator net.exe session 1>NUL 2>NUL || (powershell "Start-Process -FilePath Cmd.exe -ArgumentList \"/c %~dpnx0\" -Verb RunAs" & goto :eof)
but the script is not running.
i need to run as administrator coz i have few environment variables to be set as system variables.
Can you please suggest what is missing