Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 2 Jahren, 1 Monat
Letzter Beitrag:
vor 2 Jahren, 1 Monat
Beteiligte Autoren:
Yaku, Paulo Oliveira, Peter Holemans, Fabrice Harari

Service Start/Stop/Restart from a remote PC

Startbeitrag von Yaku am 17.05.2016 06:52

Hi everyone,
I've tried the Windev functions for doing what I've written in the subject of this topic (ServiceStart/ServiceStop/ServiceRestart) on a local machine, and it worked pretty well. My next step is to try to run these from a Client PC, in order to handle the specified service on the Server PC. Following the Windev's guide, it says that to use any of these functions, the user must be an administrator on the remote PC, and in my case, he can't be one... I wonder, is there another way to shut down/start up a service on a remote PC? Am I missing something about these functions, like some parameters that i've missed other than the name of the service and the IP of the remote computer?
TIA

Antworten:

Hi,

All the WX functions do is interact with the Windows API's for managing services.
I never use the WX functions but use the SC command instead to create, remove, start, stop, restart services etc...
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682107(v=vs.85).aspx

It is important that the user that runs the command (if it be the WX command or the SC command) has sufficient privileges on the remote machine to do so.

I assume your computers are part of an AD domain. If so, make sure the user logged on to the machine executing the script to do something on a remote machine has sufficient privileges on that remote machine to do so what you want. If the machine is not part of an AD domain I guess you'll first have to do some sort of logon to that machine with a user profile of that machine that has sufficient privileges.

Just my 2 cents,

Peter Holemans

von Peter Holemans - am 17.05.2016 07:41
Hi Peter,
thank you for your quick and exhaustive answer.
That "logon" that you're talking about is something that i'm very interested in, and i'm currently studying a way to do so, maybe with a webservice installed on the same pc that runs the service... Is there a Windows API or some Windev functions for handling Windows users?

von Yaku - am 17.05.2016 08:28
Hello Yaku

there is a quite simple way around it...

You don't want to give admin privileges to your user, you just want him to have THAT specific right...

So, create a service on the server. This server will monitor something (like a file on disk or a record in a DB)
Your user will simply write this file or record (it can be encrypted, with a very specific syntax) by using a small program installed on his pc
When the service sees the flag, it will start/stop the other service (and it will be able to do so because it will have the corresponding rights)

Best regards

von Fabrice Harari - am 17.05.2016 12:04
you can try with ExeRemoteRun function using another user/password. try to run the SC command in the machine with the service.

http://doc.windev.com/en-US/?1000018695

von Paulo Oliveira - am 17.05.2016 12:59
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.