Script to login to remote share and run batch file
Posted on 2014-09-11
I need help writing a script that will login to a shared folder on a server in another domain (it requires username and password authentication - then the shared folder is available). Let's say I'm on COMPUTER1.mydomain.com trying to login to a share on SERVER1.thatdomain.com for instance, when I do this I have to authenticate with username and password. I put in my credentials and authenticate with no problem, then I execute a batch file to run on SERVER1.thatdomain.com.
I do not want the script to execute locally. So will I need to specify the server and login within the script to have it execute on SERVER1.thatdomain.com?
The idea is to restart a service on the server named SERVER1.thatdomain.com, but I have to athenticate first from COMPUTER1.mydomain.com.
Can I do this with a batch or powershell? What is best? Thank You!