|
-
Feb 2nd, 2000, 02:51 PM
#1
Thread Starter
Junior Member
We have a PC bank here and we need a new way to reset them remotely from another machine. Is this possible in VB?
-
Feb 3rd, 2000, 06:12 AM
#2
Addicted Member
The new version of RAS does it nicely. It's in your NT Backoffice stuff. Study up on it before you install it, because it can really wipe out a network if not set up correctly.
-
Feb 3rd, 2000, 07:23 AM
#3
Check out InitiateSystemShutdown API.
You can shutdown remote computer (WinNT only), like this:
Code:
Private Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, lpMessage As String, dwTimeout As Long, bForceAppsClosed As Boolean, bRebootAfterShutdown As Boolean) As Boolean
Private Sub Command1_Click()
Dim lRet
lRet = InitiateSystemShutdown("PCName", "Shutdown...", 0, True, False)
End Sub
Subsitute PCName with the name of the computer you want to shutdown.
------------------
Serge
Senior Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
-
Feb 4th, 2000, 05:28 PM
#4
Thread Starter
Junior Member
Thanks, I tried the API call but no matter what timeout i give it it pops up on the targeted pc with a dialog saying the computer will be shut down in 14 days and the comment is giberish characters. Any ideas why?
-
Feb 4th, 2000, 06:35 PM
#5
Thread Starter
Junior Member
Figured it out, silly thing to overlook. The other variables were just missing ByVal, once they had it the call worked perfectly. Thank you
-
Feb 12th, 2000, 10:11 PM
#6
Hyperactive Member
How could you shut down multiple machines? Can you separate PCNames with commas??
Simon
-
Feb 14th, 2000, 11:11 AM
#7
Thread Starter
Junior Member
All i do to reset all 120 pc's is i have a listbox with all the pc's names in it (so we can exclude any that are acting up) and i do a loop that reads the names off the listbox and inserts it for lpmachinename. It's easier here since all our machines are named in numberical order (pc001, pc002, ect). The only problem i've had is I'm not sre how to get a heartbeat from the PC to make sure it can respond to the restart command. As it is if the pc is not reachable it hangs the program untilt he API call times out. this tends to cause other problems.
-
Feb 14th, 2000, 12:37 PM
#8
Member
can't it just PING the machine?
------------------
Rapmaster
-
Feb 14th, 2000, 02:34 PM
#9
Thread Starter
Junior Member
One side problem I've more or less gotten around is when a pc writes a response file (more on that below) and my program tries to read and delete it it sometimes tries to delete while the file is still being written. I have a loop with an aritrary number to delay the process a few ticks but would like to find a better way. Is there a way to test if the file can be deleted? Right now i'm just going to say on error wait and try it again a bit later.
In reguards to the last post, I could do it that way but it's messier, that spams out 120 windows at once all of which would dump the ping data into a file which would have to be opened and read in order to check if the ping failed. This would work since any system my program runs on in here has a minimum of 2 processors but i've come up with a diffrent way.
In order to see if the pc's rebooted I made a routine that copies out a cmd file to the startup directory of all the pc's (this works because that all login as the same user). The cmd's run when the machine reboots and autologs in, when it runs it copies a empty file to one of my programs subdirectories using the computer name as the filename, then the cmd deletes itself. Meanwhile my reset program has gone into a loop where every few seconds it checks for files in the directory, checks them against the pc names and when it finds one marks it off and deletes the file. This continues until all the expected pc's are marked off or 30 seconds has passed since the last login (needed because ocasinaly for whatever reason a pc reboots and does not send a reply back). I'm going to alter the copy routine to know if it suceeded in the copy and if it doesn't to automaticaly move the pc that didn't respond to the exclude list so nothing tries to run on it for the rest of the test.
This may seem all needlessly complex but we're running a lab where we test Terminal Server (look it up onthe Wimcrosoft homepage under NT Terminal Server or win2k Advanced Server or Datacenter) and due to the requirements we need a completely server based application that provides feeback and generaly simplifies the testing procedure. This routine is simple compared to what i had to rig up to actually get the script playback to work correctly. If anyone has some suggestions please let me know.
-
Mar 4th, 2000, 04:31 PM
#10
Lively Member
Looping to shutdown multiple machines
Sorry to sound really dumb, but looping is quite new to me!
I have a .txt file with machine names listed on each line.
EG. (art-14.txt)
ART-14-1
ART-14-2
ART-14-3
ART-14-4
etc
I need a little bit of code that will load the text file, read off each line, and using some sort of loop, insert it as the PCName.
I've been playing for a bit but keep hitting the preverbial wall!
Hope someone can help! Thanks
Simon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|