View Single Post
Old May 17th, 2005, 4:08 AM   #1
FelixM
Newbie
 
Join Date: May 2005
Posts: 7
Rep Power: 0 FelixM is on a distinguished road
2 things, 1 prob easy, other not

****You can ignore this - have fixed the bit I thought was hard - would like to get the easy bit done - see follow up post.****

I want to save the following IP address into the created textfile - what's wrong with this code? Second thing, perhaps not so eay - how would I save the file as the given IP address?

Dim outFile

' Header line for screen output
strMsg = IPconfig

strComputer = "."
Set objWMIService = GetObject( _
"winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
("Select IPAddress from Win32_NetworkAdapterConfiguration ")

For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) _
to UBound(IPConfig.IPAddress)
WScript.Echo IPConfig.IPAddress(i)
Next
End If
Next

dim FSobj
set FSobj=CreateObject("Scripting.FileSystemObject")

set outFile= FSobj.CreateTextFile("outFile.txt", 2, True)
outFile.write strMsg
outFile.Close

WScript.Echo "Output stored to outFile.txt in same directory as script."

Last edited by FelixM; May 17th, 2005 at 5:52 AM.
FelixM is offline   Reply With Quote