Manage network card VBS script _vbs

Source: Internet
Author: User
' Dislan.vbs
' Usage:cscript/nologo Dislan.vbs
Const Ssfcontrols = 3
Sconnectionname = "Local Area Connection"
Senableverb = "enabled (&a)"
Sdisableverb = "Disabled (&b)"

Set Shellapp = CreateObject ("Shell.Application")
Set Ocontrolpanel = Shellapp.namespace (ssfcontrols)

Set onetconnections = Nothing
For each folderitem in Ocontrolpanel.items
If folderitem.name = "Network and dial-up connections" then
Set onetconnections = Folderitem.getfolder:exit for
End If
Next

If Onetconnections is Nothing Then
Wscript.Quit
End If

Set olanconnection = Nothing
For each folderitem in Onetconnections.items
If LCase (folderitem.name) = LCase (Sconnectionname) Then
Set olanconnection = Folderitem:exit for
End If
Next

If Olanconnection is Nothing Then
Wscript.Quit
End If

Benabled = True
Set Oenableverb = Nothing
Set Odisableverb = Nothing
s = "Verbs:" & vbCrLf
For each verb in olanconnection.verbs
s = S & vbCrLf & Verb.name
If Verb.name = Senableverb Then
Set Oenableverb = verb
Benabled = False
End If
If Verb.name = Sdisableverb Then
Set Odisableverb = verb
End If
Next


If Benabled Then
Odisableverb.doit
Else
Oenableverb.doit
End If

Wscript.Sleep 1000

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.