Page 1 of 1 1
Topic Options
#47558 - 2003-11-04 01:54 PM Create a txt file with the hostname
ECTSPM Offline
Fresh Scripter

Registered: 2001-01-03
Posts: 10
Loc: São Paulo
Hi friends.
I have two problems:

1-) I need to create txt files using the hostname.
Ex: hostname = amsp808329
file = amsp808329.txt

2-) After that, I need to insert information about O.S., CPU, RAM and HD in the txt created.

I need to do this using logon script. My network has computers with Windows 95, 98, ME, NT 4.0 and Windows 2000.
Exists some way to do this ?
In advance, many thanks.

Top
#47559 - 2003-11-04 02:03 PM Re: Create a txt file with the hostname
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
By far the easiest method you can do this with would be WRITEPROFILESTRING into an INI file format.

If that is not an option, then -
code:
 IF EXIST('H:\TROUBLE.TXT')
DEL 'H:\TROUBLE.TXT' ; Delete the diagnostic each time
ENDIF
IF Open(3,'H:\TROUBLE.TXT',5)=0
$x=WriteLine(3,' Last Logon Date: '+@date+@CRLF)
$x=WriteLine(3,' Last Logon Time: '+@time+@CRLF)
$x=WriteLine(3,' Kixtart Version: '+@kix+@CRLF)
$x=WriteLine(3,' Logon Server: '+@lserver+@CRLF)
$x=WriteLine(3,'User/ Machine data below this line.'+@CRLF)
$x=WriteLine(3,' Full Name: '+@fullname+@CRLF)
$x=WriteLine(3,' User ID: '+@userid+@CRLF)
$x=WriteLine(3,' OS Type: '+$client+@CRLF)
$x=WriteLine(3,' Workstation Name: '+@wksta+@CRLF)
$x=WriteLine(3,' Ip Address: '+$ipadr+@CRLF)
$x=WriteLine(3,' MAC Address: '+@address+@CRLF)
$x=WriteLine(3,' Machine Priveleges: '+@priv+@CRLF)
$x=WriteLine(3,'Virus information below this line.'+@CRLF)
$x=WriteLine(3,' Virus DAT Version: '+$datnum+@CRLF)
$x=WriteLine(3,' Virus Engine Version: '+$engine+@CRLF)
$x=WriteLine(3,' Virus Product Version: '+$product+@CRLF)
$x=WriteLine(3,'Browser Settings Below this line.'+@CRLF)
$x=WriteLine(3,' Hidden PC=1.'+@CRLF)
$x=WriteLine(3,' Browsable PC=0.'+@CRLF)
$x=WriteLine(3,' Browser Setting: '+$hidden+@CRLF)
$x=WriteLine(3,'ePO Anti-Virus Agent Info'+@CRLF)
$x=WriteLine(3,' ePO Agent Installed: '+$epo+@CRLF)
$x=WriteLine(3,' Microsoft Outlook Version: '+$outlookver+@CRLF)
ENDIF
$x=Close(3)

HTH,

Kent

[ 04. November 2003, 14:07: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#47560 - 2003-11-04 03:48 PM Re: Create a txt file with the hostname
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
quote:
Ex: hostname = amsp808329
file = amsp808329.txt


code:
$file=@WKSTA+'.txt'

Might be time to read the KiXtart Manual?

You might also want to search this board for hardware inventory scripts!
_________________________
There are two types of vessels, submarines and targets.

Top
#47561 - 2003-11-04 04:00 PM Re: Create a txt file with the hostname
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You might also want to try it with quotes.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#47562 - 2003-11-04 06:30 PM Re: Create a txt file with the hostname
ECTSPM Offline
Fresh Scripter

Registered: 2001-01-03
Posts: 10
Loc: São Paulo
@kdyer
Many Thanks! Your code worked fine. I made only minor changes:
IF EXIST('c:\ '+@wksta +'.TXT')
.
.
Open(3, 'c:\ '+@wksta +'.TXT',5)=0

and placed other little things that I want. [Wink]

@sealeopard
You didn´t help but, thanks anyway.

Regards,

[ 04. November 2003, 18:35: Message edited by: ECTSPM ]

Top
#47563 - 2003-11-04 07:21 PM Re: Create a txt file with the hostname
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
So you only want to create the file if it exists?

code:
 
IF EXIST('c:\ '+@wksta +'.TXT')
.
.
Open(3, 'c:\ '+@wksta +'.TXT',5)=0


Top
#47564 - 2003-11-04 07:24 PM Re: Create a txt file with the hostname
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
For ease of use you should look at the Writelog2() UDF. It makes life very easy.

[ 04. November 2003, 19:24: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#47565 - 2003-11-04 07:25 PM Re: Create a txt file with the hostname
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
ECTSPM,
Hmmm... Kent gets the thanks, but you did use Jens' suggestion, and I now see quotes where before there were none. [Confused] [Confused]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1067 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.059 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org