How can I run a javaw process in PowerShell scripts at Windows Startup with Group Policy?

0
0
Asked By CuriousCat42 On

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

Answered By CodeCrafter88 On

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.

CuriousCat42 -

Got it! That makes sense since the error mentions it can't find javaw.exe. I'll give that a try.

Answered By TechWizard99 On

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.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.