Not a programmer, but still need help with .vbs file

I know so little about programming that I'm not even sure that I'm posting this in the right place.  

Here's the deal.  I've got my hands on a .vbs file (pinched from MIcrosoft) that turns on NetBIOS over TCP/IP.  Problem is, there are several "WScript.Echo" lines that produce annoying pop-up messages.  I would like to banish them so that this file runs silently, but in my modest attempts at editing the file, I just end up screwing it up.

If somebody could just show me what to get rid of I would be very appreciatve (and will of course give up the points)


On Error Resume Next
 
Const ENABLE_NETBIOS_VIA_DHCP = 0
Const ENABLE_NETBIOS = 1
Const DISABLE_NETBIOS = 2
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
WScript.Echo VbCrLf & "Host Name: " & strComputer
For Each objNicConfig in colNicConfigs
  WScript.Echo VbCrLf & "  Network Adapter " & objNicConfig.Index & _
   "    " & objNicConfig.Description & VbCrLf & _
  "    Attempting to set NetBIOS over TCP/IP default."
  intNetBIOS = objNicConfig.SetTCPIPNetBIOS(ENABLE_NETBIOS_VIA_DHCP)
  If intNetBIOS = 0 Then
    WScript.Echo "    Successfully set NetBIOS over TCP/IP default."
  ElseIf intNetBIOS = 1 Then
    WScript.Echo "    Successfully set NetBIOS over TCP/IP default." & _
     VbCrLf & "    Must reboot."
  Else
    WScript.Echo "    Unable to set NetBIOS default."
  End If
Next
 
WScript.Echo VbCrLf & String(80, "-")
 
Set colNicConfigs = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
For Each objNicConfig In colNicConfigs
  WScript.Echo VbCrLf & _
   "  Network Adapter " & objNicConfig.Index & VbCrLf & _
   "    " & objNicConfig.Description
  intNetBIOS = objNicConfig.TcpipNetbiosOptions
  Select Case intNetBIOS
    Case 0 strNetBIOS = "Use NetBIOS setting from the DHCP server"
    Case 1 strNetBIOS = "Enable NetBIOS over TCP/IP"
    Case 2 strNetBIOS = "Disable NetBIOS over TCP/IP"
  End Select
  WScript.Echo "    NetBIOS Over TCP/IP: " & strNetBIOS
Next
LVL 3
zamotiAsked:
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.

guidwayCommented:
try this:

On Error Resume Next
 
Const ENABLE_NETBIOS_VIA_DHCP = 0
Const ENABLE_NETBIOS = 1
Const DISABLE_NETBIOS = 2
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
'WScript.Echo VbCrLf & "Host Name: " & strComputer
For Each objNicConfig in colNicConfigs
  'WScript.Echo VbCrLf & "  Network Adapter " & objNicConfig.Index & _
  ' "    " & objNicConfig.Description & VbCrLf & _
  '"    Attempting to set NetBIOS over TCP/IP default."
  intNetBIOS = objNicConfig.SetTCPIPNetBIOS(ENABLE_NETBIOS_VIA_DHCP)
  If intNetBIOS = 0 Then
    'WScript.Echo "    Successfully set NetBIOS over TCP/IP default."
  ElseIf intNetBIOS = 1 Then
   ' WScript.Echo "    Successfully set NetBIOS over TCP/IP default." & _
'     VbCrLf & "    Must reboot."
  Else
   ' WScript.Echo "    Unable to set NetBIOS default."
  End If
Next
 
'WScript.Echo VbCrLf & String(80, "-")
 
Set colNicConfigs = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
For Each objNicConfig In colNicConfigs
  'WScript.Echo VbCrLf & _
   '"  Network Adapter " & objNicConfig.Index & VbCrLf & _
   '"    " & objNicConfig.Description
  intNetBIOS = objNicConfig.TcpipNetbiosOptions
  Select Case intNetBIOS
    Case 0 strNetBIOS = "Use NetBIOS setting from the DHCP server"
    Case 1 strNetBIOS = "Enable NetBIOS over TCP/IP"
    Case 2 strNetBIOS = "Disable NetBIOS over TCP/IP"
  End Select
  'WScript.Echo "    NetBIOS Over TCP/IP: " & strNetBIOS
Next
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
guidwayCommented:
all lines that have WScript.Echo should have a single apostrophe in front of them which tells the language to ignore these lines. If a command spans multiple lines you have to put an apostrophe on every single line that is a part of that command.

hope this helps
guid
0
zamotiAuthor Commented:
Just what the doctor ordered!  

I frickin' love EE!

Thank you very much!
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

LandyJCommented:
In VBS, the comment character is a ' (single quote) so to keep the lines in but just comment them, you get:

**********************************
On Error Resume Next
 
Const ENABLE_NETBIOS_VIA_DHCP = 0
Const ENABLE_NETBIOS = 1
Const DISABLE_NETBIOS = 2
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
'WScript.Echo VbCrLf & "Host Name: " & strComputer
For Each objNicConfig in colNicConfigs
'  WScript.Echo VbCrLf & "  Network Adapter " & objNicConfig.Index & _
'   "    " & objNicConfig.Description & VbCrLf & _
'  "    Attempting to set NetBIOS over TCP/IP default."
  intNetBIOS = objNicConfig.SetTCPIPNetBIOS(ENABLE_NETBIOS_VIA_DHCP)
'  If intNetBIOS = 0 Then
'    WScript.Echo "    Successfully set NetBIOS over TCP/IP default."
'  ElseIf intNetBIOS = 1 Then
'    WScript.Echo "    Successfully set NetBIOS over TCP/IP default." & _
'     VbCrLf & "    Must reboot."
'  Else
'    WScript.Echo "    Unable to set NetBIOS default."
'  End If
Next
 
'WScript.Echo VbCrLf & String(80, "-")
 
Set colNicConfigs = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
For Each objNicConfig In colNicConfigs
'  WScript.Echo VbCrLf & _
'   "  Network Adapter " & objNicConfig.Index & VbCrLf & _
'   "    " & objNicConfig.Description
  intNetBIOS = objNicConfig.TcpipNetbiosOptions
'  Select Case intNetBIOS
'    Case 0 strNetBIOS = "Use NetBIOS setting from the DHCP server"
'    Case 1 strNetBIOS = "Enable NetBIOS over TCP/IP"
'    Case 2 strNetBIOS = "Disable NetBIOS over TCP/IP"
'  End Select
'  WScript.Echo "    NetBIOS Over TCP/IP: " & strNetBIOS
Next
**********************

Or to remove the lines altogether:
************************
On Error Resume Next
 
Const ENABLE_NETBIOS_VIA_DHCP = 0
Const ENABLE_NETBIOS = 1
Const DISABLE_NETBIOS = 2
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colNicConfigs = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
For Each objNicConfig in colNicConfigs
  intNetBIOS = objNicConfig.SetTCPIPNetBIOS(ENABLE_NETBIOS_VIA_DHCP)
Next
 
Set colNicConfigs = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
For Each objNicConfig In colNicConfigs
  intNetBIOS = objNicConfig.TcpipNetbiosOptions
Next
*****************************
0
LandyJCommented:
Oops, working off an old version of the page.  Didn't see the answer already.
0
zamotiAuthor Commented:
Thanks anyway!  One can never have too much help.
0
guidwayCommented:
glad to hear it worked. thanks! :)
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
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.