Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
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
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:16 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC