Jump to content

Batch file to restart Synergy services


GuyOxford

Recommended Posts

If like me you are a little fed up of going through the process of turning of Windows firewall > restarting Synergy service > starting Synergy > connecting > turning back on firewall then you may wish to use a batch file to make the process easier...

I am no expert and there may be a better way of doing this but this is what I have used and it works for me.  Copy the following commands into Notepad and save on your Desktop with a suitable name like 'restart_Synergy.cmd' on the computers you want to connect.  When you want to connect right click the file and run as Administrator.  You may wish to adjust the timeouts a little so that they are running at roughly the same time giving yourself enough time to jump from one machine to the next:

@echo off

taskkill /F /im synergy2.exe
NetSh Advfirewall set allprofiles state off
TIMEOUT 1
net stop Synergy
TIMEOUT 4
net start Synergy
TIMEOUT 4

START C:\"Program Files"\Synergy\synergy2.exe

TIMEOUT 10
NetSh Advfirewall set allprofiles state on

 

If you have any issues, Google CMD batch files.  I hope this is helpful to other people.

Link to comment
Share on other sites

But that says to disable to firewall, not to restart it.

Have you noticed that after you get connected you are able to enable the firewall, or have you explicitly opened up ports?

Link to comment
Share on other sites

1 hour ago, JDDoesIT said:

But that says to disable to firewall, not to restart it.

Have you noticed that after you get connected you are able to enable the firewall, or have you explicitly opened up ports?

You should be able to re-enable the firewall once Synergy has connected.  You most certainly do not want to leave it disabled.  What I have given is what works for me... have you tried?

Link to comment
Share on other sites

on my experience, we need to disable the firewall, once all the display connected. then re-enable the firewall (For Windows 10 only)

for os x no need to disable firewall.

 

Link to comment
Share on other sites

1 hour ago, Curry said:

on my experience, we need to disable the firewall, once all the display connected. then re-enable the firewall (For Windows 10 only)

for os x no need to disable firewall.

 

Thanks Curry, I should perhaps have pointed out that my solution above is for Windows only and specifically I am using 2 Windows 10 machines.

Link to comment
Share on other sites

I use Norton Internet Security and don't have to do anything with the firewall to get Synergy to work.  However, I usually log in as a local user w/o admin permissions (windows 10 pro), so the batch file did not work for me without some reworking.  Removing the firewall commands I was able to get the following modification to work for me:

********************

echo off

taskkill /f /im synergy2.exe
timeout 1
net stop synergy
timeout 4
net start synergy
timeout 4
cd c:\"program files"\synergy
runas /noprofile /env /user:<sub user name here as required by runas> "c:\program files\synergy\synergy2.exe"

********************

It does require me to enter the admin and my user passwords, but that's better than a totally manual alternative.  The /noprofile parameter is needed for runas or the S2 GUI will come up asking to log into Symless before it will connect.  I didn't try it without the /env parameter.

 

Link to comment
Share on other sites

Just now, Big G said:

I use Norton Internet Security and don't have to do anything with the firewall to get Synergy to work.  However, I usually log in as a local user w/o admin permissions (windows 10 pro), so the batch file did not work for me without some reworking.  Removing the firewall commands I was able to get the following modification to work for me:

 

Thanks Big G

Link to comment
Share on other sites

I should add that even on my laptop (the client) I don't have a separate admin account set up, but I still have to run the batch file as admin (but not password is requested) to get it to run correctly.  Just an FYI if anyone is having problems.

Link to comment
Share on other sites

The firewall commands are not necessary if rules are setup correctly. In fact, people in a corporate environment may be prevented from disabling the firewall. 

Link to comment
Share on other sites

3 hours ago, IT Troll said:

The firewall commands are not necessary if rules are setup correctly. In fact, people in a corporate environment may be prevented from disabling the firewall. 

I tried to make rules and exceptions in my Firewall without success so went for the disable firewall option.  Perhaps you could let us all know what firewall settings worked for you.

Link to comment
Share on other sites

2 minutes ago, GuyOxford said:

Perhaps you could let us all know what firewall settings worked for you.

I have done so several times already in this forum. These best post for all the information is the troubleshooting sticky.

 

Link to comment
Share on other sites

  • Synergy Team
1 minute ago, GuyOxford said:

Thanks Nick, all appears to be working very well now.

That's great to hear!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...