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.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill BachPresident and Btrieve GuruCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GerhardpetAuthor Commented:
Thanks for your help Bill!

There will be only one user making copies of the database so your solution will work fine.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.