Hi all,

As you can tell by my name, I am completely new at this. My coworker and I are creating a small package that grabs the current IP of the PC in question, then puts it into a host file. We've gotten as far as putting the IP in the host file, however, we would like to have it say "Landesk" then a tab, then the IP. We are stumped as to how to insert a tab between landesk and the IP, and for the matter, we're stumped as to how to get landesk before the IP, as it seems to put it at the top of the text file, regardless of whether there's already text there or not. So, to sum it up, we need the file to say "Landesk <tab> <IP address>".

I've done a search here on the forum and haven't found anything as of yet, so any help would be much appreciated.

Thanks.
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Hi Wisen00b,

Personally, I would do a custom action as a vbs file. To do what you want the vbscript could look like this (note that I'm no scripting guru so someone else might have a better way...):

hostfile = "C:\WINDOWS\system32\drivers\etc\hosts"

Set fso = CreateObject("Scripting.FileSystemObject")
set txtStream = fso.OpenTextFile(hostfile, 8, True)

txtStream.WriteLine "192.0.0.1" & vbtab & "Landesk"
Set txtStream = Nothing


Run this as a custom action and it should be fine. Note you'll want to change the IP address (obviously).

Hope that helps

Paul
Answered 11/23/2004 by: plangton
Second Degree Blue Belt

Please log in to comment
0
The quick way to complete this task is to use the script editor and simply use the action "Insert line into text file". Get the IP into a variable like %IP%. Your insert line should look like "LANDESK %IP%". You can use notepad to create the text line to insert, then just cut and paste it into the action.
Answered 12/06/2004 by: Danno
Yellow Belt

Please log in to comment
0
Sorry for not replying to this sooner. Thanks for the help guys. [8D]
Answered 12/29/2004 by: Wisenoob
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity