How to reboot a remote server using VB?

5 pts.
Tags:
Scripting
VBScript
Windows Management Instrumentation
Windows scripting
WMI
how to reboot a remote server using vb
ASKED: October 29, 2008  11:40 AM
UPDATED: October 30, 2008  1:14 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

CODE
‘==========================================================================

‘ NAME: WMIon9x.vbs

‘ AUTHOR: Mark D. MacLachlan , itSynergy
‘ URL: http://www.itSynergy.com
‘ (c)2004 All Rights Reserved
‘ DATE : 1/29/2004

‘ COMMENT: Sets registry keys to enable WMI on Win9x computers.

‘==========================================================================

on error resume next

Dim path

Set WSHShell = Wscript.CreateObject(“WScript.Shell”)
SET oFSO = Wscript.CreateObject(“Scripting.FileSystemObject”)
‘set the key path here. IF you don’t end with a ” then WSH assumes you are pathing to a value.
path = “HKLM\Software\Microsoft”

WSHShell.RegWrite path & “OLE\EnableDCOM”,”Y”,”REG_SZ”
WSHShell.RegWrite path & “OLE\EnableRemoteConnect”,”Y”,”REG_SZ”
WSHShell.RegWrite path & “WBEM\cimom\EnableAnonConnections”,”1″,”REG_SZ”
WSHShell.RegWrite path & “WBEM\cimom\AutostartWin9x”,”1″,”REG_SZ”

strSup = WshShell.SpecialFolders(“Startup”)
strshortcut = strSup & “\WindowsManagement.lnk”
If Not oFSO.FileExists(strshortcut) Then
SET oUrlLink = WshShell.CreateShortcut(strshortcut)
oUrlLink.TargetPath = “C:\WINDOWS\SYSTEM\WBEM\WINMGMT.EXE”
oUrlLink.Save
End If

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following