Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues running SetResolution.exe as a scheduled task. #11

Open
NabuTheWise opened this issue Dec 2, 2024 · 4 comments
Open

Issues running SetResolution.exe as a scheduled task. #11

NabuTheWise opened this issue Dec 2, 2024 · 4 comments

Comments

@NabuTheWise
Copy link

I'm with a school system that's trying to use your application as a scheduled task (we're trying to compensate for an issue between some classroom computers and the TV they're plugged into).

I've come across a problem running the application as a scheduled task. Originally, I thought it was an issue with running under the system account but in playing with things further, by using a local administrative account, it seems that the issue is more insidious.

For troubleshooting, I'm running a scheduled task with the following properties:

Program: CMD.EXE

Arguments: /C "C:\Program Files\SetResolution\SetREsolution.exe" SET -w 3840 -h 2160 -f 29 -noprompt > C:\TechDiv\Logs\SetResolution.log 2>&1

And that gives me the output to the log file of:

Set Resolution v0.2.1

(c) West Wind Technologies, 2022-2024

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Westwind.SetResolution.SetResolutionProcessor.SetResolution()
at Westwind.SetResolution.SetResolutionProcessor.Process()
at Westwind.SetResolution.Program.Main(String[] args)

If I instead run the following from an administrative command prompt:

"C:\Program Files\SetResolution\SetREsolution.exe" SET -w 3840 -h 2160 -f 29 -noprompt > C:\TechDiv\Logs\SetResolution.log 2>&1

I get this output:

Set Resolution v0.2.1

(c) West Wind Technologies, 2022-2024

Couldn't find a matching Display Mode.

Available Monitors

1 Generic PnP Monitor
2 Generic PnP Monitor * (Main)
3 Generic PnP Monitor

Available Display Modes (8)

1920 x 1200 *
1920 x 1080
1680 x 1050
1600 x 900
1600 x 1024
1440 x 1080
1280 x 720
1176 x 664

(And yes, I realize that this isn't a great test on my computer - I don't have the available resolutions, but it's also been failing to run on the type of stations that we ultimately want it running from.)

I'd also attempted running this as the .Net tool but the system account seemed to have trouble keeping it loaded. (I hadn't really gotten far into testing it as the tool since I'd noticed that it wasn't staying available.)

Thanks!

Nabu

@timrcm
Copy link

timrcm commented Dec 20, 2024

Nabu,

I'm successfully using this as a scheduled task for a project. What is your task's trigger? If it is upon user login, you will want to add a sleep/delay for a couple of seconds -- the task tries to run instantly before the GUI is fully rendered, and thus fails.

I'm hoping to suggest a fix to handle this scenario more gracefully, but that is a functional workaround.

@NabuTheWise
Copy link
Author

NabuTheWise commented Dec 20, 2024 via email

@RickStrahl
Copy link
Owner

The display settings are user specific so if you running a scheduled task under an admin account, then that's not affecting the specific user's display settings.

@NabuTheWise
Copy link
Author

NabuTheWise commented Jan 6, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants