If boolWireless = True Then
Set colServiceList = objWMIService.ExecQuery ("Select * from
Win32_Service where Name='SWFTPClient'")
For Each objService In colServiceList
teste = objService.ChangeStartMode("Automatic")
objService.StartService()
WScript.Echo "Iniciado"
Next
Else
boolWireless = False
UpdateAdapter objItem.NetConnectionID, True
End If
Sub UpdateAdapter(targetConnection, enable)
Set sa = CreateObject("Shell.Application")
Set NetConn = sa.Namespace(49)
Set Connections = NetConn.Items
For i = 0 To Connections.Count - 1
If Connections.Item(i).Name = targetConnection Then
Set cnx = Connections.Item(i)
If (enable and cnx.Verbs.Item(0).Name = "En&able") or (not enable
and cnx.Verbs.Item(0).Name = "Disa&ble") then cnx.Verbs.Item(0).DoIt()
WScript.Sleep 10000
End If
Next
End Sub
So Shinbaum give me tip, but I need help to can do this!!!
(Crash,
You will need to destroy the connection and create a new one to get the
updated status.
I would suggest that you make a function that returns the status.
Inside the
fucntion is where you open the connection to get the status, then at
the end
of the function close the connection. That way each time you call the
function you will get the current status.
Shinbaum)