Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'==========================================================================
'
' NAME: CloneServices.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.TheSpidersParlor.com[/URL]
' COPYWRITE (c) 2006 All Rights Reserved
' DATE : 6/3/2006
'
' COMMENT: Run on a server to export/import Service startup modes
' This script and many more are available in the Admin Script Pack
' by The Spider's Parlor. [URL unfurl="true"]http://www.TheSpidersParlor.com/vbscript[/URL]
'==========================================================================
Const ForAppending = 8
Const ForReading = 1
Const strComputer = "."
Set objFSO = CreateObject("Scripting.FileSystemObject")
Prompt = GetAction()
Select Case Prompt
Case "1","Import","import","IMPORT"
ImportServices
Case "2","Export","export","EXPORT"
ExportServices
End Select
Function ImportServices()
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
'open the data file
Set oTextStream = objFSO.OpenTextFile("service_list.csv",ForReading)
'make an array from the data file
ServiceList = Split(oTextStream.ReadAll, vbNewLine)
'close the data file
oTextStream.Close
For Each ServiceStr In ServiceList
On Error Resume Next
ServiceInfo = Split(ServiceStr,",")
ServiceName = ServiceInfo(0)
ServiceStartState = ServiceInfo(1)
Set objServiceResults = objSWbemServices.Get("Win32_Service.Name=""" & ServiceName & """")
errReturnCode = objServiceResults.ChangeStartMode(ServiceStartState)
Next
WScript.Echo "Services Configuration Imported"
End Function
Function ExportServices()
Set objLogFile = objFSO.OpenTextFile("service_list.csv", _
ForAppending, True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery _
("Select * from Win32_Service")
For Each objService in colListOfServices
objLogFile.Write(objService.Name) & ","
objLogFile.Write(objService.StartMode) & ","
objLogFile.writeline
Next
objLogFile.Close
WScript.Echo "Services Configuration Exported"
End Function
Function GetAction()
GetAction = InputBox("Do you wish to Import or Export Service Information?" & vbCrLf _
& "1 = Import" & vbCrlf & "2 = Export","Import or Export Service Info?")
End Function