Score:-1

Run powershell script on a remote computer using PsExec

in flag

I am using below code to run a powershell script using PsExec. But it does not seem to work. I am using Start-Process cmdlet to run PsExec using Powershell.

Start-Process -FilePath C:\tmp\PSExec.exe -ArgumentList "\\server.fqsn.com Powershell.exe '-ExecutionPolicy Bypass -File C:\tmp\email.ps1'"

Any help on this is greatly appreciated.

Thank you.

djdomi avatar
za flag
what is the business related question in here?
user25998 avatar
in flag
I am getting an error saying %1 PSEXECSVC is not a valid win32 application error. I see that PSEXEC creates the PSEXECSVC on the remote computer. But it's 0KB. No matter how many times I run it after deleting the service "sc delete PSEXECSVC" I get the same error. I'm not sure what's wrong.
djdomi avatar
za flag
psexec should be executed directly usually, imho there is no need to use a other command infront of it.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.