#66984 - 2002-06-14 03:14 AM
Re: Errors Creating INI and LOG files on WIN95
|
mschipper
Fresh Scripter
Registered: 2002-05-07
Posts: 10
Loc: Adelaide
|
Thanks for those tips..
I like the idea of UDF's but am having some issues getting my head around them..
I ran the KIXSTRIP400 program over the script and only came up with one error.. in my SYNCTIME sub. Which i fixed.. although i dont think that was the problem im addressing here..
Here is where i think the problem is:
code:
:verifyinitialsetup ; REM *********************************************************************** ; REM ** ; REM ** This routine verifies that the local computer has the '@LDOMAIN' ; REM ** directory created on it. This directory is used to store debugging ; REM ** information, as well as configuration information. ; REM ** This routine also opens the debug log file, so it is possible to ; REM ** trace through the log and see where (if) the script fails. ; REM ** Checks to see what OS the client is running. ; REM ** In addition, the script checks to see if you have ever seen the ; REM ** security warning / logging message (on a new system setup for ; REM ** instance), or if it is the 1st day of the month. ; REM ** Finally, this script checks to see if you are a member of the ; REM ** 'Domain Admins' group and sets the '$Privilege' variable ; REM ** accordingly. ; REM ** ; REM *********************************************************************** $rollover = "NO"
IF (Exist("$Datapath"+"Debug.log") <> 0) $debugsize = GetFileSize("$Datapath"+"Debug.log") IF $debugsize >= "150000" $filedate = replace(@date,"/","") $rollover = "YES" COPY "$Datapath"+"Debug.log" "$Datapath"+"$fileDate"+"-Debug.log" DEL "$Datapath"+"Debug.log" ENDIF ENDIF IF (Exist ($inifile) <> 1) MD "$SysDrive\@LDOMAIN" IF @error <> 0 $emailmessage = "Could not create @LDOMAIN directory on @WKSTA. Please check immediately!" GOSUB SendAdminMail MessageBox ("There is an error in your system configuration that is preventing you from being logged onto the network succesfully. Please contact IT support for assistance.","Notice",4112) ENDIF $displaywarning = "Yes" ENDIF $dummy = Open (10, $debugfile, 5) IF $rollover <> "NO" $dummy = WriteLine (10, "*** Debug.log rolled over to $fileDate-Debug.log" + Chr(13) + Chr(10)) ENDIF $dummy = WriteLine (10, "*** Debug Log Started @TIME @DATE." + Chr(13) + Chr(10)) $dummy = WriteLine (10, "@FULLNAME logged in as @USERID to @WKSTA." + Chr(13) + Chr(10)) SELECT CASE (@producttype = "Windows 2000 Professional") ; REM ** What OS are we running? $os = "Win2K" CASE (@producttype = "Windows NT Workstation") $os = "WinNT4" CASE (@producttype = "Windows 98") $os = "Win98" CASE (@producttype = "Windows 95") $os = "Win95" ENDSELECT
IF ($displaywarning = "No") ; REM ** Should we really show the security message? IF (@mdayno = 1) IF (ReadProfileString ($inifile, "LastSeen", "SecurityMessage") <> $dayssince1970) $displaywarning = "Yes" ENDIF ELSE IF (($dayssince1970 - ReadProfileString ($inifile, "LastSeen", "SecurityMessage")) >= 1) $displaywarning = "Yes" ENDIF ENDIF ENDIF SELECT ; REM ** What is the user's privilege level? CASE InGroup("Domain Admins") $privilege = "Domain Admin" CASE InGroup("\\@WKSTA\Administrators") $privilege = "Local Admin" CASE InGroup("\\@WKSTA\Power Users") $privilege = "Power User" CASE 1 $privilege = "User" ENDSELECT RETURN
and.......
code:
:patch ; REM *********************************************************************** ; REM ** ; REM ** Checks to see if the OS needs any patches installed ; REM ** ; REM *********************************************************************** ; REM ** Local variables in use by this function are:
IF (Exist ($patchfile) <> 1) MD "$SysDrive\@LDOMAIN\Patch" MD "$SysDrive\@LDOMAIN\Patch\$OS" MD "$SysDrive\@LDOMAIN\Patch\IE" IF @error <> 0 $emailmessage = "Could not create PATCH directory's on @WKSTA. Please check immediately!" GOSUB SendAdminMail MessageBox ("There is an error in your system configuration that is preventing you from being logged onto the network succesfully. Please contact IT support for assistance.","Notice",4112) ENDIF ENDIF
$adinstalled = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{89820200-ECBD-11cf-8B85-00AA005B4395}", "IsInstalled") SELECT CASE $os = "WINNT" IF $adinstalled = 1 $ospatch = $nt4sp6ad_patch $sourcepatch = "@LDRIVE"+"Patch"+"\"+"$OSAD"+"\"+"$OSPatch" $destpatch = "$DataPath"+"Patch"+"\"+"$OS"+"\"+"$OSPatch" ELSE $ospatch = $nt4sp6_patch $sourcepatch = "@LDRIVE"+"Patch"+"\"+"$OS"+"\"+"$OSPatch" $destpatch = "$DataPath"+"Patch"+"\"+"$OS"+"\"+"$OSPatch" ENDIF CASE $os = "WIN98" $ospatch = $w98_patch $sourcepatch = "@LDRIVE"+"Patch"+"\"+"$OS"+"\"+"$OSPatch" $destpatch = "$DataPath"+"Patch"+"\"+"$OS"+"\"+"$OSPatch" CASE $os = "WIN95" IF $adinstalled = 1 $ospatch = $w95ad_patch $sourcepatch = "@LDRIVE"+"Patch"+"\"+"$OSAD"+"\"+"$OSPatch" $destpatch = "$DataPath"+"Patch"+"\"+"$OS"+"\"+"$OSPatch" ELSE $ospatch = $w95_patch $sourcepatch = "@LDRIVE"+"Patch"+"\"+"$OS"+"\"+"$OSPatch" $destpatch = "$DataPath"+"Patch"+"\"+"$OS"+"\"+"$OSPatch" ENDIF CASE $os = "WIN2K" $ospatch = $w2k_patch $sourcepatch = "@LDRIVE"+"Patch"+"\"+"$OS"+"\"+"$OSPatch" $destpatch = "$DataPath"+"Patch"+"\"+"$OS"+"\"+"$OSPatch" CASE 1 $dummy = WriteLine (10, "Unknown operating system, aborting outlook configuration." + Chr(13) + Chr(10)) $status = "Aborted " RETURN ENDSELECT
$status = " " + Chr(251) + " OK "
IF $ospatch <> "" IF (ReadProfileString ($patchfile, "$OS", "$OSPatch") <> DONE) COPY $sourcepatch $destpatch RUN "$DestPatch /Q" $dummy = WriteProfileString ($patchfile, "$OS", "$OSPatch", "DONE") $dummy = WriteLine (10, "$OS Patch ($OSPatch) has been installed on @WKSTA" + Chr(13) + Chr(10)) $status = "Updated " ENDIF ENDIF
IF ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer", "Version") = "5.50.4807.2300" IF $ie_patch <> "" IF (ReadProfileString ($patchfile, "IE", "$IE_Patch") <> DONE) $sourcepatch = "@LDRIVE"+"Patch"+"IE"+"\"+"$IE_Patch" $destpatch = "$DataPath"+"Patch"+"IE"+"\"+"$IE_Patch" COPY $sourcepatch $destpatch RUN "$DestPatch /Q" $dummy = WriteProfileString ($patchfile, "IE", "$IE_Patch", "DONE") $dummy = WriteLine (10, "Internet Explorer Patch ($OSPatch) has been installed on @WKSTA" + Chr(13) + Chr(10)) $status = "Updated " ENDIF ENDIF ENDIF RETURN
The email i receive (two of them generated from these areas of code) are:
Could not create PATCH directory's on USER. Please check immediately!
and...
Could not create POLYAIRE directory on USER. Please check immediately!
Thanks again. MARK. [ 14 June 2002, 04:55: Message edited by: mschipper ]
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|