Steve Neel sent in a tip on how to create a script to start and stop your web server without having to be on the console. The script will prompt for the server name and whether you want to start or stop the services. This script even works via dial-up connection. Of course, you need administrator privileges on the server for this to work.
'This script will Start or Stop the IIS related services on a remote server
'
Dim ServerName
Dim ServiceSet
Dim Service
Dim StartStop
Sub StopServices()
Set ServiceSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//" _
& servername).ExecQuery("select * from Win32_Service")
For each Service in ServiceSet
if Service.Description = "World Wide Web Publishing Service" then
If Service.State = "Running" Then
Service.StopService()
End If
ElseIf Service.Description = "Microsoft SMTP Service" then
If Service.State = "Running" Then
Service.StopService()
End If
ElseIf Service.Description = "FTP Publishing Service" then
If Service.State = "Running" Then
Service.StopService()
End If
ElseIf Left(Service.Description, 9) = "IIS Admin" then
If Service.State = "Running" Then
Service.StopService()
End If
ElseIf Service.Description = "MSDTC" then
If Service.State = "Running" Then
Service.StopService()
End If
End If
Next
End Sub
Sub StartServices()
Set ServiceSet =
GetObject("winmgmts:{impersonationLevel=impersonate}!//" &
servername).ExecQuery("select * from Win32_Service")
For each Service in ServiceSet
if Left(Service.Description, 9) = "IIS Admin" then
If Service.State <> "Running" Then
Service.StartService()
End If
ElseIf Service.Description = "Microsoft SMTP Service" then
If Service.State <> "Running" Then
Service.StartService()
End If
ElseIf Service.Description = "FTP Publishing Service" then
If Service.State <> "Running" Then
Service.StartService()
End If
ElseIf Service.Description = "World Wide Web Publishing Service" Then
If Service.State <> "Running" Then
Service.StartService()
End If
ElseIf Service.Description = "MSDTC" then
If Service.State <> "Running" Then
Service.StartService()
End If
End If
Next
End Sub
ServerName = InputBox("Enter the NetBIOS Name of the Server you would like to process")
StartStop = InputBox("Would you like to START or STOP the IIS services? " _
& (Chr(13) & Chr(10)) & "Please Enter 'start' or 'stop'" & (Chr(13) & Chr(10)) _
& "OR 'quit' to Exit","Start Or Stop Remote IIS Services","quit")
If lcase(StartStop) = "stop" Then
StopServices
Wscript.Echo "Services Stopped!"
ElseIf lcase(StartStop) = "start" Then
StartServices
Wscript.Echo "Services Started!"
Else
Wscript.Echo "No Action Taken."
End If