Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Script Adapter Network

1 view
Skip to first unread message

CrashGirl

unread,
May 16, 2006, 12:24:42 PM5/16/06
to
Hi people,
Anyone knows how to create a Sub to update network card??
For example my script check connection if True restarts my service, is
not update network card, but I can´t use my Sub UpdateAdapter anyone
can show me wrong???

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)

0 new messages