I am looking for a way with which i can autostart a certain program on logon of a user with user-rights with administrator-rights.
I already tried using task scheduler but it didn't work out because you got to enter a username with format machine\user and our pxe-image-deployment-system automatically patches the machine names so the entered domain\user stopped working.
the runas.exe command does not seem appropiate for this task, too. If using /user:machinename\Administrator /savcred it is invalid after imaging. What one user suggested was using .\Administrator or localhost\Administrator but both didn't work on my XP SP3 machines.
In the program i need to execute this function is getting used:
[DllImport("user32.dll")] public static extern int ExitWindowsEx(int uFlags, int dwReserved);
when using the programs suggested by Alan Kuras this function is failing, which is a no-go for me.
Yes! I got it, I think! It seems like you could not use ExitWindowsEx when running under another users context.
I simply switched my application to WTSLogoffSession and now it's working!