Information Technology Reference
In-Depth Information
To stop the service, type the following in the command window:
> net stop remoteaccess
Using VBScript
To stop RRAS on the local computer, use the following code:
'This code will stop the Routing and Remote Access Services
'---SCRIPT CONFIGURATION ---
strComputer = "."
'---END CONFIGURATION---
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='remoteaccess'")
For each objService in colServiceList
errReturn = objService.StopService()
Next
WScript.Echo ("RRAS service has been stopped.")
To start RRAS on the local computer, use the following similar code instead:
'This code will start the Routing and Remote Access Services
'---SCRIPT CONFIGURATION---
strComputer = "."
'---END CONFIGURATION---
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='remoteaccess'")
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='remoteaccess'")
For each objService in colServiceList
errReturn = objService.StartService()
Next
WScript.Echo ("RRAS service has been started.")
To restart RRAS on the local computer, combine the previous two code segments into a
single one, as follows:
'This code will restart the Routing and Remote Access Services
'---SCRIPT CONFIGURATION---
strComputer = "."
'---END CONFIGURATION---
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
("Select * from Win32_Service where Name='remoteaccess'")
Search WWH ::




Custom Search