bridge connection vbscript

I would like to write a code (vbscript) that will enable me to connect 2 network interfaces in a bridge.
It will be executed under windows xp.
aquaswAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jared LukerCommented:
You can do that with a simple batch file using the NetSH utility.  You can code it into VB if you want as well..

http://www.microsoft.com/windowsxp/using/networking/expert/crawford_02april22.mspx

netsh bridge set a 1 e

'Start VB
Set WshShell = WScript.CreateObject("WScript.Shell")
wshshell.run "netsh bridge set a 1 e"

'End VB

You will need to change the a and e based on the instructions in that article.
0
sr75Commented:
Here is a copy of a script that I have used to automatically run the repair utility (as if I had right clicked on the nic and selected repair.  I believe it will do the same thing with Bridging connections)
'########################################################################################
'#											#
'#	Name:		RepairNIC.vbs							#
'#	Version:	1.0.0								#
'#	Created:	February 26th, 2007						#
'#	Modified:	n/a								#
'#	Description:	This script will run the repair utility on the defined NIC	#
'#											#
'#	Modified:	N/A								#
'#											#
'#	Notes:		This script uses the Control Panel via the shell.application	#
'#			Namespace.  It searches for the Network COnnections folder	#
'#			Then searches for the defined NIC.  It can then perform just 	#
'#			about action that you would normally get when you right-click	#
'#			defined NIC (including Enabling/Disabling the NIC)		#
'#											#
'#			Verb				Script Command			#
'#			----------------------------------------------------------	#
'#			Enable 				En&able (if disabled)		#
'#			Disable				Dis&able (if enabled)		#
'#			Status				Stat&us				#
'#			Repair				Re&pair				#
'#			Bridge Connections		Brid&ge Connections		#
'#			Create Shortcut			Create &Shortcut		#
'#			Delete				???				#
'#			Rename				Rena&me				#
'#			Properties			P&roperties			#
'#											#
'########################################################################################
'---------------------------------------------------------------------------
'
'				Main Function
'
'---------------------------------------------------------------------------
On Error Resume Next
 
 
'================================
'      Define Constants
'================================
Const ssfCONTROLS = 3
Const conVerb = "Re&pair"
 
 
'================================
'        Set Variables
'================================
strConnection = "External"
 
Set WShell = CreateObject("Wscript.Shell")
set Shell = CreateObject("Shell.Application")
set objCP = Shell.Namespace(ssfCONTROLS)
set objNetCon = Nothing
set objLanCon = Nothing
 
 
'================================
'       Get Object
'================================
For Each Folder in objCP.items
	If Folder.Name = "Network Connections" then
		set objNetCon = Folder.GetFolder: Exit For
	End If
Next
 
If objNetCon is Nothing then
	wscript.quit
End If
 
 
'================================
'         Perform NIC Repair
'================================
For Each Connection in objNetCon.Items
	If lcase(Connection.Name) = lcase(strConnection) then
		set objConnection = Connection
		strStatus = ObjConnection.invokeverb(conVerb)
		Wshell.popup strstatus,30
 
	End If
Next
 
 
'================================
'        Perform Clean Up
'================================
Set WShell = Nothing
set Shell = Nothing
set objCP = Nothing
set objNetCon = Nothing
set objLanCon = Nothing

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Jared LukerCommented:
sr75...

Do you know if that script works on Vista?  That would be a good one for my wife to run when  the wireless card on our Kitchen PC forgets its job.
0
sr75Commented:
I tested it on Vista and it didn't work, but it might help point you in the right direction for a script that will work on Vista.
0
Jared LukerCommented:
ok... thanks

aquasw... sorry to derail your thread...

we now continue with our regularly scheduled program...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.