Output 2 items from script to 2 text boxes

This script below is a .vbs but I would like to use javascript. Is is possible to take the information this script retreives and send that info to 2 text boxes.

On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

arrComputers = Array("SM-57-11-80")
For Each strComputer In arrComputers
   WScript.Echo
   WScript.Echo "=========================================="
   WScript.Echo "Computer: " & strComputer
   WScript.Echo "=========================================="

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
   Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkConnection", "WQL", _
                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)

   For Each objItem In colItems
      WScript.Echo "ConnectionType: " & objItem.ConnectionType
      WScript.Echo "UserName: " & objItem.UserName
      WScript.Echo
   Next
Next


Function WMIDateStringToDate(dtmDate)
WScript.Echo dtm:
      WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
      Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
      & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
End Function
msammisAsked:
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.

gops1Commented:
Give a try:


<script language="javascript">
function Puttotext(){
  document.form1.textbox.value = <%=WMIDateStringToDate%>;
}
</script>
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
msammisAuthor Commented:
I think you are right but I'll tell you what I am trying to acomplish and see if you can further help.
I should have provided you some better details.

I am trying to retreive some information from the "SELECT * FROM Win32_NetworkConnection", "WQL", _

      WScript.Echo "ConnectionType: " & objItem.ConnectionType
      WScript.Echo "UserName: " & objItem.UserName

I want to do this using javascript but I only have vbs code and I do not know enough javascript to rewrite the code.

I need to information to populate in a web page, 2 text boxes.

I will still try to use your first suggestion as well but if you have and idea I'd sure appreciate it !
0
msammisAuthor Commented:

I just need the script below in vbs script to output the items to a text area or text box in a web page.



Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

arrComputers = Array("localhost")
For Each strComputer In arrComputers

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
   Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkConnection", "WQL", _
                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)

   For Each objItem In colItems
     
      WScript.Echo objItem.UserName
   Next
Next


Function WMIDateStringToDate(dtmDate)
WScript.Echo dtm:
     WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
     Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
     & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
End Function
0
msammisAuthor Commented:
I got an error type mismatch on the last script attempt
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
JavaScript

From novice to tech pro — start learning today.