Hey everyone! I'm trying to run a PowerShell script during Windows startup using Group Policy, and while it works fine when I run it manually, I ran into some trouble with the javaw process. My script looks like this: Start-Process -FilePath javaw.exe -ArgumentList '-jar C:temptest.jar'. However, I get an error saying 'ERROR: The process "javaw.exe" not found.' I've enabled transcript logging, and I see that the transcript starts but then it fails. Any ideas on how to fix this?
2 Answers
Try using the full path to javaw.exe in your script. For example, something like 'C:Program FilesJavajdk_versionbinjavaw.exe' instead of just 'javaw.exe'. PowerShell may not know where to look for it otherwise.
Have you thought about using Scheduled Tasks instead of Group Policy? It could be more reliable for running scripts like this. Also, make sure that javaw.exe is included in your system's PATH variable; if it's not, PowerShell won't find it when the script runs.
Got it! That makes sense since the error mentions it can't find javaw.exe. I'll give that a try.