Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Disable Wireless using a process triggered by an event. (VBScript / WMI)

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,64958
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Disable Wireless using a process triggered by an event. (VBScript / WMI)
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Disable Wireless using a process triggered by an event.... - 10/9/2008 10:08:22 PM   
  KenPark

 

Posts: 2
Score: 0
Joined: 9/28/2008
Status: offline
'I am trying to develope a script that will run as a service and be triggered by an event. I have a    VBScripts called - NetworkConnectionEvent
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\wmi")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery("Select * from MSNdis_StatusMediaConnect")
Do While True
   Set strLatestEvent = colMonitoredEvents.NextEvent
   'msgbox "New Connection Found"
   CheckNetworkStatus()
Loop
Function CheckNetworkStatus()
blnOnTreasuryNetwork = False
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colConfig = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration Where DNSDomain = 'olympus.treasury.gov'",,48)
For Each objItem in colConfig
   blnOnTreasuryNetwork = True         
   Exit For
Next
Set colAdapters = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter where ProductName like '%Wireless%'",,48)
For Each objAdapter in colAdapters
   If blnOnTreasuryNetwork Then
     'Disable Wireless           
     objAdapter.disable
   Else
     'Enable Wireless
     Call objAdapter.Enable()
   End if
Next
End Function
'The problem I am getting is the I get an error referring to this line 'objAdapter.disable'. '
'I know it is an object I can use, and I have double-checked the syntax.
'Alternatively - If you can think of a better, neater way to capture and event triggered by a wireless card being plugged
'in/turned on, then I'm happy to hear it. Basically I need to be able to disable the wireless service, regardless of
'make/model/type whenever the physical NIC gets a DNSDomain name that meets my criteria.
'unfortunately the only way I can think of doing this is to have something monitoring this, otherwise there would be
'times/occurrences where wireless and nic connectivity could run together.
 
 
Post #: 1
 
 RE: Disable Wireless using a process triggered by an ev... - 10/10/2008 4:51:20 PM   
  yfki

 

Posts: 78
Score: 0
Joined: 12/12/2007
Status: offline
You need to google that disable method...

Sounds very similar...

http://software.intel.com/en-us/forums/mobilized-software-development/topic/60164/

(in reply to KenPark)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Disable Wireless using a process triggered by an event. (VBScript / WMI) Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts