I'm having a difficult time coming up with a solution to extend a framework that was designed for *nix machines over to windows. The framework currently runs from one *nix server and ssh's out to other *nix servers and performs a bunch of different commands like checking log files, syncing files from source control, submitting logs back to source control, etc. The big piece I'm stuck on is how to connect to the remote windows machines and access the command line. The connection can be coming from another Windows machine also, it doesn't have to start from a unix machine, it can go from windows to windows instead of unix to windows.
Here's an example of how commands are currently ran on unix systems. Something like this is in a loop that goes through a list of server names. I need to get something like this to run on windows machines.
ssh ${user}@${server} "cd /app/app_name/logs; <export source control params>; <submit logs to source control>" >> Log.txt
Also, I would prefer not to use a 3rd party tool (my budget is about $0). I've checked out PsExec and a couple others but it looks like you need admin access or have to pass users/pass in plain text.
Best Answer
Use Powershell Remoting:
Updated link: https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/running-remote-commands?view=powershell-7
Copy pasted form an older version: