#47558 - 2003-11-04 01:54 PM
Create a txt file with the hostname
|
ECTSPM
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
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 ]
|
|
Top
|
|
|
|
#47562 - 2003-11-04 06:30 PM
Re: Create a txt file with the hostname
|
ECTSPM
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.
@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
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
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 ]
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 1014 anonymous users online.
|
|
|