I have a powershell script and from inside this, i want to run a batch script as differend user. That means i have a AD service user account and with this i must run the batch script. It must work like a scheduled task in windows, where you can run it as differend user without store the password.
Now the question is how i can run the batch script from inside a powershell script with the service user and don't need to store the password in the Powershell script?
i have tried this:
Start-Process -Credentil "Domain\Account" -FilePath "CMD.exe" -Argumentlist "/c C:\myScript.cmd"
The result is that a window pops up where i must typ in the password for the service user.
Can any one help me with this?
Thank you and best regards, Nico