VBscript from domain controller
- From: Luki <Luki@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Jul 2008 13:49:00 -0700
Hallo Microsoft Team!
I want to modify a vbs script with following sourcecode:
Some parts of the sourcecode comments are written in german.
That program writes userlogons in a txt file that is called logon.log
The logon.log file is a txt file and if u double click on that logon.log u
can see all users that was logged and u see the date when they were logged
in.
logon_log.vbs:
'-------- HISTORIE --------
'10.2003 Roman Herndl AD Logonprotokoll
Set WshNetwork = CreateObject("WScript.Network")
set wshshell = CreateObject("WScript.Shell")
CRLF = Chr(13) & Chr(10)
TAB = "; "
Erstlogon = true
set oArguments = WScript.Arguments
'-------- M A I N --------
'Info bei starten ohne Startargumente
If WScript.Arguments.Count < 1 Then
WScript.Echo "Use Syntax: 'UNC-Pfad\logon_log.vbs UNC-Pfad\Protokolldatei'"
WScript.Quit
End If
'Startparameter einlesen
pfad = oArguments.item(0)
'-------- Benutzer abfragen --------
user = WSHNetwork.UserName
'-------- M A I N --------
Set fs = createObject("Scripting.FileSystemObject")
if not fs.FileExists(pfad) then
set Datei=FS.CreateTextfile(pfad, true)
Datei.close
end if
if fs.FileExists(pfad) then
set dateiinhalt = fs.OpenTextFile(pfad)
do until dateiinhalt.atEndOfStream
inhalt = dateiinhalt.readline
if instr(inhalt,user) > 0 then
logfile = logfile & user & TAB & date & CRLF
Erstlogon = false
else
logfile = logfile & inhalt & CRLF
end if
loop
if Erstlogon then logfile = logfile & user & TAB & date
dateiinhalt.close
Set inhalt = fs.OpenTextFile(pfad, 2, True)
inhalt.Write logfile
end if
logon.log:
testuser1; 11.04.2001
testuser2; 17.01.2002
testuser3; 19.05.2003
For example u see that when you open the logon.log file. And now i want to
find out the logoff date from the users in the Active Directory from Windows
Server 2003 OS.
What can i do?
Iam a noobie at VBscript. Is there any possibility to write the users not in
the logon.log but in another file that called logon.htm with html table tags
and with table headers like user; and date or in MS EXCEl file?
Please can u help me?
.
- Follow-Ups:
- Re: VBscript from domain controller
- From: Nils Kaczenski [MVP]
- Re: VBscript from domain controller
- Prev by Date: Re: verschachtelte Gruppen mit ADSI und WinNT Provider
- Next by Date: Re: VBscript from domain controller
- Previous by thread: verschachtelte Gruppen mit ADSI und WinNT Provider
- Next by thread: Re: VBscript from domain controller
- Index(es):