|
Thanks you guys once again made my life easy, everything works now below is the working script.
$w2kwxp = @PRODUCTTYPE = "Windows 2000 Professional" OR @PRODUCTTYPE = "Windows XP Professional"
If $w2kwxp Dim $WSHNetwork, $fso $WSHNetwork = CreateObject("WScript.Network") $fso = CreateObject("Scripting.FileSystemObject")
Dim $LogEntry $UName = @USERID $DName = @LDOMAIN $CName = @WKSTA
Dim $Status $Status = "NotLogged" If $fso.FileExists("\\nserv\wkslogs$\" + $CName + ".txt") Dim $SearchString $SearchString = ($DName + "\" + $UName) Dim $ParseFile, $TextStream, $TextLine $ParseFile = $fso.GetFile("\\nserv\wkslogs$\" + $CName + ".txt") $TextStream = $ParseFile.OpenAsTextStream While Not $TextStream.AtEndOfStream $TextLine = $TextStream.ReadLine If InStr($TextLine,$SearchString) <> 0 $Status = "AlreadyLogged" EndIf Loop $TextStream.Close EndIf
If $Status = "NotLogged" Dim $Logfile $Logfile = ("\\nserv\wkslogs$\" + $CName + ".txt") Dim $ologfile $ologfile = $fso.OpenTextFile($Logfile, 8, True) $ologfile.writeline ($DName + "\" + $UName) $ologfile.close EndIf EndIf
Sleep 7
Exit
|