I think my request is going to be SUPER simple for somone on this forum. I’m NOWHERE near great at powershell, on a scale of 1-10 im a 1. Hoping somone would love to help a new sys-admin out here.
I’m looking to run an exe with command line switches remotley on a computer, as the currently logged in users.
I’m hoping to load the scrpit, it asks for what computer i’d like to migrate (dialog box for pc name), then issue a command to that computer and run the exe that would be called under the user thats currently logged into that computer.
This: “that would be called under the user thats currently logged into that computer” is nearly impossible, given the security model in Windows. You would need to know that user’s name and password, at the very least.
Oh. OK. Well, that’s vaguely disturbing from a security perspective, but sure.
You then run into a second problem. All of the means we have to remotely start processes can, by default, only be done by Administrators. But, if you do it as Administrator, then it’ll run under Administrator, not the logged-on user. If you do it as the logged-on user’s name and password, you’ll get an Access Denied.
Again, you’re going up against a very serious and deeply rooted part of Windows’ security setup. These things are designed to prevent malware from spreading, and they’re very embedded in the OS architecture.
What exactly would the invoke-command scrpitliet look like? like i said i am HORRIBLE with powershell, so if its just a matter of changing some information in a command i can do that, but creating one from scratch i have no idea how to do it.
If you run Update-Help first, it’ll contain numerous examples. I’d far prefer to get you started learning this than to just give you commands, but they all tend to have excellent help examples.
Additionally, go get “Learn Windows PowerShell in a Month of Lunches, 3rd Edition.” There’s an entire chapter on Remoting (Invoke-Command) which will take you under 45m to read, and it will change your life and career. Guaranteed.