I log in as domain user and i want in powershell (or in simple console, no matter) to run a program. the program clean user appdata unnecessary files so it has to operate within user profile. I can do runas but i got profile of admin user. How can i reach domain user profile? in silly words something like Start-Process -Verb runas -Credential adminuser -LoadUserProfile domainuser -FilePath c:\Programm Files... . Is it possible at all?
You can't run PS code natively as another user, especially remotely. It is a Windows OS security boundary.
PS always runs in the user context who launched it.
You'd have to use some other tool for that, for examples SysInternals PSExec.
Your other option is the copy the scrip to the user's machine and set a RunOnce in the registry, or use a scheduled task to run once, only when the user is logged on.