Skip to content

Instantly share code, notes, and snippets.

@robertogalan
Last active August 28, 2023 15:18
Show Gist options
  • Save robertogalan/b8d07d4f9521307938ca318a688e2a1f to your computer and use it in GitHub Desktop.
Save robertogalan/b8d07d4f9521307938ca318a688e2a1f to your computer and use it in GitHub Desktop.
Using Microsoft Sysinternals to open/close a program on several machines over a local Windows network.
@echo off
rem Use the username and password of the administrator account on the remote machines.
set username = admin
set password = pass
rem Set the IP addresses and names of the remote machines.
set desk1name_ip = 192.168.1.200
set desk2name_ip = 192.168.1.201
rem repeat the above for all machines
rem Open Notepad.exe on desk1
.\psexec -s \\desk1name notepad.exe
rem Open Notepad.exe on desk2
.\psexec -i \\desk2name notepad.exe
rem repeat the above for all machines
rem reuse with pskill instead of psexec to close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment