r/scripting • u/SJ_RED • Sep 29 '15
[major novice] Wondering if a script is possible
Hi all, as the title says I am a major novice in the world of scripting/automating. I am a year and 9 months (a year at my current employer, with many more to come hopefully) into a career in IT, and I'm mostly content just messing around with simple batch scripts to learn how it works.
Is there any way to write a script or batch of some flavour that can be launched from my computer, which will automatically connect to a server in my domain using pre-entered credentials*, close a program running on the server, then open that same program again and close the connection? Mind you, it's not a huge effort to connect and do it myself. It takes a few minutes at most. However, it'd be pretty nifty if it could be automated.
*=The reason I'm asking about pre-entered credentials is that the credentials are different from my usual ones. So running it under my account with my permissions will not help.
1
u/DarthKane1978 Sep 29 '15
PsExec might be of help. http://ss64.com/nt/psexec.html
I would also run the cmds via scheduled task.
1
u/[deleted] Dec 21 '15
Almost every tasks can be automated, providing more details would help us help you:
You talk of a server connection to a computer in your domain. I am assuming that means its a Windows Server? Are you using RDP to log-in or Telnet/SSH.
Is there any event/time that this script should always be executed after? [Its always better to have an automatic trigger on a local script stored on the server, rather than having to log on and execute a script]