Page 1 of 1 1
Topic Options
#40857 - 2003-05-30 02:21 PM Re-dircting output.
The_Apprentice Offline
Fresh Scripter

Registered: 2003-05-30
Posts: 16
Loc: Guildford, England
Me again [Smile]

I am trying top output a list of installed hotfixes from the registry (W2K).

I am using the eaxample from ENUMKEY, but how can I redirect the output to a text file.

; Read Hotfixes Registry Key
$Index = 0
:Loop1
$KeyName = ENUMKEY("HKEY_CURRENT_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\HotFix\ ", $Index)
If @ERROR = 0
? "Name found: $KeyName"
$Index = $Index + 1
goto Loop1
Endif

Many thanks in advance

Sean

Top
#40858 - 2003-05-30 02:25 PM Re: Re-dircting output.
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Read on towards the back of the manual.

(Hint: Look for RedirectOutput() [Wink] )

Top
#40859 - 2003-05-30 02:31 PM Re: Re-dircting output.
The_Apprentice Offline
Fresh Scripter

Registered: 2003-05-30
Posts: 16
Loc: Guildford, England
:$

Got bored searching on "output"

Trying it now.

Top
#40860 - 2003-05-30 02:38 PM Re: Re-dircting output.
The_Apprentice Offline
Fresh Scripter

Registered: 2003-05-30
Posts: 16
Loc: Guildford, England
Just realised my typo too.

WTF is HKEY_CURRENT_MACHINE ??

Top
#40861 - 2003-05-30 02:57 PM Re: Re-dircting output.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
There is no HKEY_CURRENT_MACHINE, it's either HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE and they are registry hives.

Take a look at the following KiXtart functions: OPEN/WRITELINE/CLOSE, READPROFILESTRING/WRITEPROFILESTRING, REDIRECTOUTPUT.

Take a look at the following UDFs: WriteLog2(), DisplayText(), ArrayEnumKey(), ArrayEnumValue()

[ 30. May 2003, 15:22: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#40862 - 2003-05-30 03:12 PM Re: Re-dircting output.
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Might become handy for 'roaming hardware' [Big Grin]
_________________________



Top
#40863 - 2003-05-30 03:21 PM Re: Re-dircting output.
The_Apprentice Offline
Fresh Scripter

Registered: 2003-05-30
Posts: 16
Loc: Guildford, England
I had not heard of "HEKEY_CURRENT_USER" either [Wink]
Top
#40864 - 2003-05-31 01:14 AM Re: Re-dircting output.
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
This should work.

Change “\\computername\filename.log” to your wishes. The output file is plain text so you can read it using notepad for example, the ,0 option appends the data to the existing file if set to 1 it overwrites the existing data.

I use this to log who logged on to a specific workstation because I had some stupid users said that nobody knew there password but somebody did logon to a workstation using there account.

To use a specific filename for each computer you can also use the @WKSTA for the filename. This way you will get a logfile for each machine, might be handy for busting some users [Big Grin] (if they have install rights). Adding the time and date into the logfile has been usefull to me too. The ? "-------------" line is added to keep things readable.

code:
; Read Hotfixes Registry Key
$Index = 0
:Loop1
$KeyName = ENUMKEY("HKEY_CURRENT_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\HotFix\ ", $Index)
If @ERROR = 0
;
REDIRECTOUTPUT ("\\computername\filename", 0)
;
? "Name found: $KeyName"
;
? "-------------------------"
;
$Index = $Index + 1
goto Loop1
Endif

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#40865 - 2003-05-31 01:15 AM Re: Re-dircting output.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
"\\computername\filename.log" is not a correct filename as it misses the sharename of the remote computer's share.
_________________________
There are two types of vessels, submarines and targets.

Top
#40866 - 2003-05-31 02:56 PM Re: Re-dircting output.
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Sorry, my mistake.

Sealeopard is right. It should be like this:

code:
REDIRECTOUTPUT ("\\computername\sharename\filename", 0)

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

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 369 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

Generated in 0.061 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

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