Sponsored Links

Login Form






Lost Password?

Syndicate

Home
Reboot Remote Computer PDF Print E-mail
User Rating: / 1
PoorBest 
Written by Cheyenne Harden   
Well, I had a script that would log off all of the computers in an OU.
But, what if you just wanted to log off or reboot one computer?!?
Oops... I didn't think of that! Well, I guess I can't say that any more.
This script will allow you to reboot, logoff or shutdown any computer.

 

----------COPY EVERYTHING BELOW THIS LINE----------

'This script will logoff, shutdown or reboot a computer.
'Created by Cheyenne  Harden October 2 2006

On Error Resume Next

'remotely reboot a computer

Dim sUser,sPassword, sClient, sShutdown
Dim oFSO, oLocator, oConnection, oWindows, oSys

'set remote credentials
sUser = inputbox("Enter Login")
sPassword = inputbox("Enter password")
sClient = inputbox("Enter Name of Computer")
sShutdown = inputbox("issue shutdown to OS" & vbCrLf & "4 = force logoff" & _
vbCrLf & "5 = force shutdown" & _
vbCrLf & "6 = force rebooot" & _
vbCrLf & "12 = force power off")

'open list of client names
Set oFSO = CreateObject("Scripting.FileSystemObject")
 
 'get WMI locator
 Set oLocator = CreateObject("WbemScripting.SWbemLocator")

 'Connect to remote WMI
 Set oConnection = oLocator.ConnectServer(sClient, _
   "root\cimv2", sUser, sPassword)


 Set oWindows = oConnection.ExecQuery("Select " & _
   "Name From Win32_OperatingSystem")
 For Each oSys In oWindows
   oSys.Win32ShutDown(sShutdown)
 Next

WScript.Echo "Task Completed!"

 

 

 

 


----------COPY EVERYTHING ABOVE THIS LINE----------

 

PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR SCRIPT!!!

To make this script work you will need three things!


1. You will need an admin login.
2. You will need an admin password.
3. Lastly, you will need the name or IP of the target computer.


This information is provided "AS IS" with no warranties expressed or implied.

Comments
Add NewSearch
TRiX - Alternative Answer     | 64.19.25.xxx | 25-09-2008 16:23:10
ok goto dos, and use shutdown /i and put the computer name in the utility provided by microsoft without having to worry about making a script...
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
 
Security Image
Please input the anti-spam code that you can read in the image.

Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved.

 
Tag it:
Delicious
Furl it!
Spurl
digg
YahooMyWeb
< Prev   Next >
 

Google Search

Google