So if you want to run node-red on a windows machine on a secondary drive and have it start automatically with a scheduled task, you can use this script to install it!

choco install nodejs --% -ia 'INSTALLDIR="D:\node-red\NodeJS"'

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")

npm install node-red --prefix D:\node-red
npm install node-red-admin --prefix D:\node-red

New-NetFirewallRule -DisplayName "Allow NodeRed" -Direction Inbound -LocalPort 1880 -Protocol TCP -Action Allow

aws s3 cp s3://paessler-node-red-test-prod/noderedconfig.txt D:\node-red\settings.js
aws s3 cp s3://paessler-node-red-test-prod/noe-red-paessler.cmd D:\node-red\node-red.cmd

$action = New-ScheduledTaskAction -Execute 'D:\node-red\node-red.cmd' -Argument '--userDir d:\node-red\node-red-data --settings D:\node-red\settings.js > d:\node-red\node-red.log 2>&1'

$principal = New-ScheduledTaskPrincipal -UserID "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest

$timespan = New-TimeSpan -Seconds 30
$trigger = New-ScheduledTaskTrigger -AtStartup -RandomDelay $timespan
$nolimittimespan = New-TimeSpan -Days 365
$tasksettings = New-ScheduledTaskSettingsSet -DontStopOnIdleEnd -ExecutionTimeLimit $nolimittimespan -DisallowHardTerminate

Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "Run Node Red" -Principal $principal -Description "Starts Node Red automatically" -Settings $tasksettings