option explicit
' Profile Type
Const NET_FW_PROFILE2_DOMAIN = 1
Const NET_FW_PROFILE2_PRIVATE = 2
Const NET_FW_PROFILE2_PUBLIC = 4

Dim fwPolicy2
Set fwPolicy2 = CreateObject("Hnetcfg.FwPolicy2")

Dim strComputer, objWMIService,colServiceList,objService,errReturn, bStartDepending
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery ("Select * from Win32_Service where Name='MpsSvc'")
    
bStartDepending = False
For Each objService in colServiceList
	If objService.Started = False Then
		errReturn = objService.StartService()
		If errReturn = 0 Then
			bStartDepending = True
		End if
	End If
Next

If bStartDepending = True Then
	Set colServiceList = objWMIService.ExecQuery("Associators of " & "{Win32_Service.Name='MpsSvc'} Where " & "AssocClass=Win32_DependentService " & "Role=Dependent" )
	For Each objService in colServiceList
	    objService.StartService()
	Next
End if

fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_DOMAIN) = TRUE
fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_PRIVATE) = TRUE
fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_PUBLIC) = TRUE
