1

I want to write some codes for a server that can Reboot(Restart) all vps s or one of them inside that server!
VPS = VIRTUAL PRIVATE SERVER
i have some questions about that:

  1. how can i write those codes with c# codes for that job? and how can i recognize every vps inside server?

  2. where should i run those codes ? form a vps inside that server or another place?(want to access all vps s inside server using VMware)

really appreciate for viewing and help
stack is always my love

SilverLight
  • 15
  • 1
  • 5

2 Answers2

1

Taken from this SO question

Process.Start("shutdown","/s /t 0");

(fits Windows machines only)

Now, combine this with a WCF service running on each VPS - you will have to code a management console (that you will use later on your computer, for instance) that will know (or, have features to add) a known VPS server (by, for example, it's IP address), and allow you to invoke this function on the remote VPSs

This way, you`ll have a service running on each VPS that allows you to sreboot, while having a management console to send shut-down directives to all or some of your servers from a remote computer

Community
  • 1
  • 1
Shai
  • 25,159
  • 9
  • 44
  • 67
1

In combination with the process.Start solution form Shai you could use psshutdown.

It does require that the boxes are domain joined, from the docs:

... and if you specify a wildcard (\*), the command runs on all computers in the current domain

rene
  • 41,474
  • 78
  • 114
  • 152
  • hi rene, does this tool work for remote server(vps)? can we use ip address as computer in it's command? (i test it, but show me it's help and nothing happens) – SilverLight Jun 13 '12 at 09:51