We help IT Professionals succeed at work.

Execute batch file from workstation on server

Is there a way to execute a batch file on a server from a workstation?

I need to execute the following command from a workstation on the server while running Syncback from the workstation. The reason is that the users will manually run a Syncback profile form the Workstation

"C:\Program Files\Pervasive Software\PSQL\PBA\BIN\pvbackup.exe" -on

"C:\Program Files\Pervasive Software\PSQL\PBA\BIN\pvbackup.exe" -off

The Pervasive backup agent is installed on the server. Basically the users will make a local copy of the database on 5 different computers with Syncback installed a few times a month.
Watch Question

President and Btrieve Guru
You can run commands remotely on a server using several different mechanisms.  The easiest is likely to be PSExec, but you can also use Powershell scripts or other utilities.  You can download PSExec from www.sysinternals.com (which will now redirect you to the right page at Microsoft.com).  The same page will have instructions and samples for you.

One thing you may need to be careful of with this command is to avoid two users doing this at the same time.  The Backup Agent should ONLY be initiated by one user at a time, and it will put ALL open database files into Continuous Operations mode at the same time.  The problem could come with two overlapping sets of calls -- one user would put the database into ContOps mode and start copying.  Another user would then come in and attempt to put the database into ContOps mode, which will fail (because BA is already activated).  The second user will then start copying files.  If the first user's copy then completes, the pvbackup -OFF command will then fire, and the delta files will start rolling in -- all while the second user is still copying files.  This can corrupt the file copy for the second user, or if a file is currently open by the COPY operation, it can prevent the roll-in of the delta file.  

In short, you should use a semaphore of some kind to keep ONE user in at a time.  Perhaps to a "pvbackup -status" at the beginning of the script, and if the status is ON, then return an error to the user to try again later.


Thanks for your help Bill!

There will be only one user making copies of the database so your solution will work fine.