Connecting Tech Pros Worldwide Forums | Help | Site Map

Converting script into VB.Net

Newbie
 
Join Date: Jan 2008
Posts: 10
#1: Feb 15 '08
I want to conert the following script in VB.Net..
I m not getting it properly.
Can anybody have idea.



On Error Resume Next

Const ALLOW_ALL = 0

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colNetCards = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")

For Each objNetCard in colNetCards
arrPermittedTCPPorts = Array(ALLOW_ALL)
arrPermittedUDPPorts = Array(ALLOW_ALL)
arrPermittedIPProtocols = Array(ALLOW_ALL)
objNetCard.EnableIPSec arrPermittedTCPPorts, arrPermittedUDPPorts, _
arrPermittedIPProtocols
Next

kenobewan's Avatar
Moderator
 
Join Date: Dec 2006
Posts: 4,745
#2: Feb 15 '08

re: Converting script into VB.Net


Quote:

Originally Posted by dvp10

I want to conert the following script in VB.Net..
I m not getting it properly.
Can anybody have idea.



On Error Resume Next

Const ALLOW_ALL = 0

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colNetCards = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")

For Each objNetCard in colNetCards
arrPermittedTCPPorts = Array(ALLOW_ALL)
arrPermittedUDPPorts = Array(ALLOW_ALL)
arrPermittedIPProtocols = Array(ALLOW_ALL)
objNetCard.EnableIPSec arrPermittedTCPPorts, arrPermittedUDPPorts, _
arrPermittedIPProtocols
Next

Is this VB6? Do you have VS2003? Have you tried a converter?
Newbie
 
Join Date: Jan 2008
Posts: 10
#3: Feb 16 '08

re: Converting script into VB.Net


i have VS2005
I havent tried converter yet
Reply