#66974 - 2002-06-14 01:41 AM
Errors Creating INI and LOG files on WIN95
|
mschipper
Fresh Scripter
Registered: 2002-05-07
Posts: 10
Loc: Adelaide
|
Hi There,
I'm having some issues with my script... on Win95 machines it doesnt seem to want to create or edit .INI files or create my DEBUG.LOG file..
Does anyone have any ideas??? I'm really puzzled about this one..
Also, if anyone has any ideas on how i can improve the script.. let me know..
Thanks.. MARK.
code:
; REM *********************************************************************** ; REM ** ; REM ** FILE NAME: Logon.KIX ; REM ** LOCATION : \NETLOGON\SCRIPTS ; REM ** DEVELOPER: Mark Schipper - mark.schipper@polyaire.com.au ; REM ** PURPOSE : Automate some client and admin tasks, as well as enforce ; REM ** some polyaire system standards. Displays security and ; REM ** logging message. Syncs time of local computer with logon ; REM ** server, configures outlook profile. Maps user's home and project directories. ; REM ** Verify the local client network configuration, as well as ; REM ** keep anti-virus signatures up-to-date. ; REM ** ; REM ***********************************************************************
; REM ** Patches
$NT4SP6_Patch = "" ; REM ** Windows NT4 SP6 Patch $NT4SP6AD_Patch = "" ; REM ** Windows NT4 SP6 (With ACTIVE DESKTOP) Patch $W98_Patch = "" ; REM ** Windows 98 Patch $W95_Patch = "" ; REM ** Windows 95 Patch $W95AD_Patch = "" ; REM ** Windows 95 Patch (With ACTIVE DESKTOP) Patch $W2K_Patch = "" ; REM ** Windows 2K Patch $IE_Patch = "" ; REM ** Internet Explorer Patch *** Checks for Correct Version
; REM ** Establish variables, constants.
$CurrentDat = "4207xdat.exe" ; REM ** Current Mcafee XDAT/SDAT file $Hoffpdc = "10.5.1.2" ; REM ** HOFFPDC IP $Hoffrad = "10.5.1.3" ; REM ** HOFFRAD IP $Hoffexc = "10.5.1.4" ; REM ** HOFFEXC IP $Mbank = "10.2.1.2" ; REM ** MBANK IP $Ttown = "10.3.1.2" ; REM ** TTOWN IP $Ctarf = "10.4.1.2" ; REM ** CTARF IP $Bwater = "10.6.1.2" ; REM ** BWATER IP $DomainName = "polyaire.com.au" ; REM ** Corporate Domain $SysDrive = (SubStr(%windir%,1,2)) ; REM ** Where is the OS installed? Win95/98 don't support %SystemDrive% $AcceptKey = "B" ; REM ** Key pressed to accept Security Warning Message $AdminEmail = "helpdesk@@"+"$DomainName" ; REM ** Where to send all of the warning messages $DaysSince1970 = ((((@YEAR - 1970) * 365) + @YDAYNO) + ((@YEAR - 1972) / 4)) $DebugFile = "$SysDrive\@LDOMAIN\Debug.Log" ; REM ** Location of the script debug log $DisplayWarning = "No" ; REM ** Do we need to show the Security Warning message $EmailMessage = " " ; REM ** Message sent to the $AdminEmail address $ErrorNumber = 0 ; REM ** Holder for Kix32 Error number $ErrorString = " " ; REM ** Holder for Kix32 Error string $INIFile = "$SysDrive\@LDOMAIN\@LDOMAIN.INI" ; REM ** INI file used for script settings and event checking $PatchFile = "$SysDrive\@LDOMAIN\PATCH.INI" ; REM ** INI file used for patch history checking $MailServer = "hoffexc" ; REM ** POP3 mail server $OS = "UnKnown" ; REM ** What OS is the client system? $Privilege = "User" ; REM ** User's priviledge level $Reboot = "No" ; REM ** Reason for rebooting the user's computer $Row = 4 ; REM ** What row to place the cursor on $Status = " " ; REM ** Reused throughout the script for status messages $TempKey = " " ; REM ** Used to capture key pressed during Security Message $TempNumber = 0 ; REM ** Reused throughout the script for several functions $TempString = " " ; REM ** Reused throughout the script for several functions $EmailName = Replace(@FULLNAME," ",".") ; REM ** Gather First part of user email address $UserEmail = "$EmailName"+"@@"+"$DomainName" ; REM ** User's email address in mixed case $HomeSvr = SubStr("@HOMESHR",3,(Len(@HOMESHR) - Len("\USERS")) - 2) ; REM ** User's Local Server $Datapath = "$SysDrive"+"\"+"@LDOMAIN"+"\" ; REM ** name of your local datapath
; REM *********************************************************************** ; REM ** ; REM ** Begin execution at the main() function at the bottom of the script ; REM ** file. Sue me, I still have this habit from old 'c' classes. :^) ; REM ** ; REM ***********************************************************************
Goto Main
:DisplayError ; REM *********************************************************************** ; REM ** ; REM ** Display an error box on the local screen, and send a message to ; REM ** one of the NT administrators to let him know. Depending on the ; REM ** number of errors occured, you may want to remark out the ; REM ** 'SENDMESSAGE' line or it could be annoying. ; REM ** ; REM ***********************************************************************
Beep $ErrorNumber = @ERROR $ErrorString = @SERROR MessageBox ("$ErrorNumber : $ErrorString", "Script Processing Error. A system administrator has been notified.", 4144, 30) $EmailMessage = "Script Processing Error $ErrorNumber ($ErrorString) occured at @TIME while @FULLNAME was logging in from @WKSTA." $Dummy = WriteLine (10, $EmailMessage + Chr(13) + Chr(10)) Gosub SendAdminMail Return
:GetDebugInfo ; REM ************************************************************************ ; REM ** ; REM ** Extra info about the client system. ; REM ** ; REM ************************************************************************ $IP00 = TrimIP(@IPaddress0) $IP01 = TrimIP(@IPaddress1) $IP02 = TrimIP(@IPaddress2) $IP03 = TrimIP(@IPaddress3)
$TempString = "KiX Information ----------------------------" + Chr(13) + Chr(10) + "KiX Version : @KIX" + Chr(13) + Chr(10) + "KiX RPC Server : @RSERVER" + Chr(13) + Chr(10) + "Script Directory : @SCRIPTDIR" + Chr(13) + Chr(10) + "Start Dir for KiX : @STARTDIR" + Chr(13) + Chr(10) + "Network Information ------------------------" + Chr(13) + Chr(10) + "Logon Domain : @LDOMAIN" + Chr(13) + Chr(10) + "Logon Server : @LSERVER" + Chr(13) + Chr(10) + "Logon Drive Ltr : @LDRIVE" + Chr(13) + Chr(10) + "Home Server : $HomeSvr" + Chr(13) + Chr(10) + "Computer Name : @WKSTA" + Chr(13) + Chr(10) + "IP Hostname : @HOSTNAME" + Chr(13) + Chr(10) + "IP Address #1 : $IP00" + Chr(13) + Chr(10) + " #2 : $IP01" + Chr(13) + Chr(10) + " #3 : $IP02" + Chr(13) + Chr(10) + " #4 : $IP03" + Chr(13) + Chr(10) + "Ethernet Address : @ADDRESS" + Chr(13) + Chr(10) + "Client Information -------------------------" + Chr(13) + Chr(10) + "Logon Name : @USERID" + Chr(13) + Chr(10) + "Users Name : @FULLNAME" + Chr(13) + Chr(10) + "Users Email : $UserEmail" + Chr(13) + Chr(10) + "Operating System : @ProductType" + Chr(13) + Chr(10) + "O/S Version : @DOS" + Chr(13) + Chr(10) + "OS Root Directory : %SYSTEMROOT%" + Chr(13) + Chr(10) + "Local User Access : $Privilege" + Chr(13) + Chr(10) + "Password Age : @PWAGE Days" + Chr(13) + Chr(10) + "User Profile Path : %USERPROFILE%" + Chr(13) + Chr(10) Return
:SendAdminMail ; REM ************************************************************************ ; REM ** ; REM ** Used to send email to the NT Administrator defined in $AdminEmail. ; REM ** Attaches a copy of the local $DebugFile to the message so we can see ; REM ** if there's a history of problems on the machine. ; REM ** ; REM ** Interprets the user's email address from their logon name. Both ; REM ** logon names as well as email addresses are based on the employee's ; REM ** insurance (employee) number. ; REM ** ; REM ************************************************************************
Gosub GetDebugInfo $PostieLoc = "$Datapath"+"POSTIE.exe" $PostieRem = "@LDRIVE"+"POSTIE.exe" $PostieParam = " -host:$MailServer -to:$AdminEmail -from:$UserEmail -s:Logon_Script_Error_on_@WKSTA -msg:" + Chr(34) + "$TempString $EmailMessage" + Chr(34) + " -q -a:$DebugFile"
If NOT Exist($PostieLoc) Copy $PostieRem $PostieLoc EndIf Run "$PostieLoc"+"$PostieParam" Return
:RandomKey ; REM ************************************************************************ ; REM ** ; REM ** Used to generate a "random" $AcceptKey. ; REM ** ; REM ************************************************************************
SRND (Val(SubStr(@TIME, 7, 2)) * 1000) $AcceptKey = Chr((Rnd (25)) + 65) Return
:DrawHeaderBox ; REM *********************************************************************** ; REM ** ; REM ** Draw header box at top of screen. The color used to draw the screen ; REM ** changes depending on the user's privilege level. ; REM ** ; REM ***********************************************************************
Select Case ($DisplayWarning = "Yes") OR ($Privilege = "Domain Admin") Color w+/r Case $Privilege = "Local Admin" Color w+/g Case 1 Color w+/b EndSelect CLS Box (0,0,2,79,DOUBLE) $TempString = "@LDOMAIN Windows NT Domain" AT (1,(39 - (Len($TempString) / 2))) $TempString Return
: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
:DrawSecurityBox ; REM *********************************************************************** ; REM ** ; REM ** Display security information box to local user, as well as make a ; REM ** copy on their local system. ; REM ** ; REM ***********************************************************************
AT (7,9) "Use of Polyaire IT facilities is governed by the IT procedures" AT (8,30) "and applicable laws." AT (12,2) "Your activity on IT facilities may be monitored. All files including email" AT (13,2) "and Internet are Polyaire business records. Business records" AT (14,2) "may be accessed by Polyaire at random without your consent. Improper" AT (15,2) "use of IT facilities may result in disciplinary action and legal liability." Gosub RandomKey Sleep 3 Box (22,0,24,78,SINGLE) AT (23,14) "Press the -< " Color w+/r+ AT (23,27) "$AcceptKey" Color w+/r AT (23,28) " >- button to indicate your acceptance." FlushKB $Dummy = SetConsole ("FOREGROUND") Do Get $TempKey Until Ucase($TempKey) = $AcceptKey ; REM ** Create 'hardcopy' of warning on local computer. $TempString = "$SysDrive\@LDOMAIN\Security.Txt" If (Exist ($TempString) = 1) If Open (1, $TempString, 4) = 0 $Dummy = WriteLine (1, "@FULLNAME (@USERID - @WKSTA) Re-Acknowledged Information at @TIME on @DATE." + Chr(13) + Chr(10)) $Dummy = Close (1) Else Gosub DisplayError EndIf Else If (Open (1, $TempString, 5) = 0) $Dummy = WriteLine (1, "@LDOMAIN Windows NT Domain" + Chr(13) + Chr(10)) $Dummy = WriteLine (1, Chr(13) + Chr(10)) $Dummy = WriteLine (1, "Use of Polyaire IT facilities is governed by the IT procedures" + Chr(13) + Chr(10)) $Dummy = WriteLine (1, "and applicable laws." + Chr(13) + Chr(10)) $Dummy = WriteLine (1, Chr(13) + Chr(10)) $Dummy = WriteLine (1, "Your activity on IT facilities may be monitored. All files including email" + Chr(13) + Chr(10)) $Dummy = WriteLine (1, "and Internet are Polyaire business records. Business records" + Chr(13) + Chr(10)) $Dummy = WriteLine (1, "may be accessed by Polyaire at random without your consent. Improper" + Chr(13) + Chr(10)) $Dummy = WriteLine (1, "use of IT facilities may result in disciplinary action and legal liability." + Chr(13) + Chr(10)) $Dummy = WriteLine (1, Chr(13) + Chr(10)) $Dummy = WriteLine (1, "If you now continue use of the system, you expressly consent to these" + Chr(13) + Chr(10)) $Dummy = WriteLine (1, "conditions of use." + Chr(13) + Chr(10)) $Dummy = WriteLine (1, Chr(13) + Chr(10)) $Dummy = WriteLine (1, "This message was last displayed to @FULLNAME (@USERID) at @TIME on @DATE." + Chr(13) + Chr(10)) $Dummy = WriteLine (1, Chr(13) + Chr(10)) $Dummy = Close (1) Else Gosub DisplayError EndIf EndIf $Dummy = WriteProfileString ($INIFile, "LastSeen", "SecurityMessage", "$DaysSince1970") $Dummy = WriteLine (10, "Displayed Security / Logging Warning Message to @FULLNAME (@USERID)." + Chr(13) + Chr(10)) $DisplayWarning = "No" Return
:SyncTime ; REM *********************************************************************** ; REM ** ; REM ** Syncronize the local system time with the logon server. The PDC ; REM ** server DOM01 syncronizes with NTP server gatekeeper.kodak.com in ; REM ** Rochester, and then acts as an NTP server to BDC DOM02-DOM04 itself. ; REM ** The NT servers must be set in the registry to act as a time server ; REM ** for the NT workstations, otherwise this won't work. ; REM ** ; REM ***********************************************************************
If ((($OS = "WinNT4") OR ($OS = "Win2K")) AND ($Privilege = "User"))) $Dummy = WriteLine (10, "User does not have permissions to set local clock." + Chr(13) + Chr(10)) Return EndIf SetTime "\\$HomeSvr" If (@ERROR <> 0) Gosub DisplayError $Status = " Error " Else $Dummy = WriteLine (10, "Syncronized local time with logon server." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " EndIf Return
:CheckDNS ; REM *********************************************************************** ; REM ** ; REM ** Checks to make sure that the DNS settings are correct. If they are ; REM ** found to be incorrect the script edits the registery to insert the ; REM ** correct values. If the script has problems doing so (general error, ; REM ** user dosen't have rights to modify the registry, etc.) a message ; REM ** is sent to the system administrators alerting them to this fact. ; REM ** ; REM *********************************************************************** ; REM ** Local variables in use by this function are: $DNS = " "
; REM ** Checks to see which Control Set is Current If ($OS = "WinNT4") $TempNumber = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\Select", "Current") $TempString = "ControlSet00"+$TempNumber EndIf
; REM ** Finds the DNS Server Settings Select Case $OS = "WinNT4" $DNS = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "NameServer") Case (($OS = "Win95") OR ($OS = "Win98")) $DNS = ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer") Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting DNS verification." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect
; REM ** Checks the DNS Settings and updates if necessary Select Case $OS = "WinNT4" If $DNS = "$hoffpdc $hoffrad" $Dummy = WriteLine (10, "Verified DNS Settings." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Else ; REM ** Sets the DNS settings correct if they are not $Dummy = WriteLine (10, "Old DNS Information: $DNS" + Chr(13) + Chr(10)) If (($Privilege = "Domain Admin") OR ($Privilege = "Local Admin")) $Dummy = WriteValue ("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "NameServer", "$Hoffpdc $Hoffrad", "REG_SZ") $Reboot = "DNS" $Dummy = WriteLine (10, "Updated DNS Settings." + Chr(13) + Chr(10)) $Status = "Updated " Else $EmailMessage = "@WKSTA (@FULLNAME) has incorrect DNS Settings. The current settings are $DNS. Please correct the settings on this system." Gosub SendAdminMail $Dummy = WriteLine (10, "$EmailMessage" + Chr(13) + Chr(10)) MessageBox ("Your DNS settings are INCORRECT but could not be changed automatically. A systems administrator has been notified of the problem.","Notice",4144) $Status = "Skipped " EndIf EndIf Case (($OS = "Win95") OR ($OS = "Win98")) If $DNS = "$hoffpdc,$hoffrad" $Dummy = WriteLine (10, "Verified DNS Settings." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Else ; REM ** Sets the DNS settings correct if they are not $Dummy = WriteLine (10, "Old DNS Information: $DNS" + Chr(13) + Chr(10)) $Dummy = WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer", "$hoffpdc,$hoffrad", "REG_SZ") $Reboot = "DNS" $Dummy = WriteLine (10, "Updated DNS Settings." + Chr(13) + Chr(10)) $Status = "Updated " EndIf Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting DNS verification." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect Return
:CheckDNSDomain ; REM *********************************************************************** ; REM ** ; REM ** Checks to make sure that DNS domain setting is correct. If ; REM ** incorrect, the script edits the registery to insert the ; REM ** correct value. If the script has problems doing so (general error, ; REM ** user dosen't have rights to modify the registry, etc.) a message ; REM ** is sent to the system administrators alerting them to this fact. ; REM ** ; REM *********************************************************************** ; REM ** Local variables in use by this function are: $Domain = " "
; REM ** Checks to see which Control Set is Current If ($OS = "WinNT4") $TempNumber = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\Select\", "Current") $TempString = "ControlSet00"+$TempNumber EndIf
; REM ** Finds the DNS Domain Settings Select Case $OS = "WinNT4" $Domain = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "Domain") Case (($OS = "Win95") OR ($OS = "Win98")) $Domain = ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "Domain") Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting DNS Domain verification." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect
; REM ** Checks the DNS Domain Setting and updates if necessary Select Case $OS = "WinNT4" If $Domain = $DomainName $Dummy = WriteLine (10, "Verified DNS Domain Settings." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Else ; REM ** Sets the DNS Domain settings correct if they are not $Dummy = WriteLine (10, "Old DNS Domain Information: $Domain" + Chr(13) + Chr(10)) If (($Privilege = "Domain Admin") OR ($Privilege = "Local Admin")) $Dummy = WriteValue ("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "Domain", $DomainName, "REG_SZ") $Reboot = "DNS Domain" $Dummy = WriteLine (10, "Updated DNS Domain Settings." + Chr(13) + Chr(10)) $TempString = "Updated " Else $EmailMessage = "@WKSTA (@FULLNAME) has incorrect DNS Domain Settings. The current settings are $Domain. Please correct the settings on this system." Gosub SendAdminMail $Dummy = WriteLine (10, "$EmailMessage" + Chr(13) + Chr(10)) MessageBox ("Your DNS Domain settings are INCORRECT but could not be changed automatically. A systems administrator has been notified of the problem.","Notice",4144) $Status = "Skipped " EndIf EndIf Case (($OS = "Win95") OR ($OS = "Win98")) If $Domain = $DomainName $Dummy = WriteLine (10, "Verified DNS Domain Settings." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Else ; REM ** Sets the DNS settings correct if they are not $Dummy = WriteLine (10, "Old DNS Domain Information: $Domain" + Chr(13) + Chr(10)) $Dummy = WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "Domain", $DomainName, "REG_SZ") $Reboot = "DNS Domain" $Dummy = WriteLine (10, "Updated DNS Domain Settings." + Chr(13) + Chr(10)) $Status = "Updated " EndIf Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting DNS Domain verification." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect Return
:CheckDNSSearch ; REM *********************************************************************** ; REM ** ; REM ** Checks to make sure that DNS suffix search order is correct. If ; REM ** incorrect, the script edits the registery to insert the ; REM ** correct value. If the script has problems doing so (general error, ; REM ** user dosen't have rights to modify the registry, etc.) a message ; REM ** is sent to the system administrators alerting them to this fact. ; REM ** ; REM *********************************************************************** ; REM ** Local variables in use by this function are: $Domain = " "
; REM ** Checks to see which Control Set is Current If ($OS = "WinNT4") $TempNumber = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\Select\", "Current") $TempString = "ControlSet00"+$TempNumber EndIf
; REM ** Finds the DNS Search Order Select Case $OS = "WinNT4" $Domain = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "SearchList") Case (($OS = "Win95") OR ($OS = "Win98")) $Domain = ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "SearchList") Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting DNS Suffix Search Order verification." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect
; REM ** Checks the DNS Suffix Search Order and updates if necessary Select Case $OS = "WinNT4" If $Domain = $DomainName $Dummy = WriteLine (10, "Verified DNS Suffix Search Order." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Else ; REM ** Sets the DNS Domain settings correct if they are not $Dummy = WriteLine (10, "Old DNS Suffix Search Order Information: $Domain" + Chr(13) + Chr(10)) If (($Privilege = "Domain Admin") OR ($Privilege = "Local Admin")) $Dummy = WriteValue ("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\Tcpip\Parameters", "SearchList", $DomainName, "REG_SZ") $Reboot = "DNS Search Order" $Dummy = WriteLine (10, "Updated DNS Suffix Search Order." + Chr(13) + Chr(10)) $Status = "Updated " Else $EmailMessage = "@WKSTA (@FULLNAME) has incorrect DNS Suffix Search Order Settings. The current settings are $Domain. Please correct the settings on this system." Gosub SendAdminMail $Dummy = WriteLine (10, "$EmailMesssage" + Chr(13) + Chr(10)) MessageBox ("Your DNS Search Order settings are INCORRECT but could not be changed automatically. A systems administrator has been notified of the problem.","Notice",4144) $Status = "Skipped " EndIf EndIf Case (($OS = "Win95") OR ($OS = "Win98")) If $Domain = $DomainName $Dummy = WriteLine (10, "Verified DNS Suffix Search Order." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Else ; REM ** Sets the DNS settings correct if they are not $Dummy = WriteLine (10, "Old DNS Suffix Search Order Information: $Domain" + Chr(13) + Chr(10)) $Dummy = WriteValue ("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "SearchList", $DomainName, "REG_SZ") $Reboot = "DNS Search Order" $Dummy = WriteLine (10, "Updated DNS Suffix Search Order." + Chr(13) + Chr(10)) $Status = "Updated " EndIf Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting DNS Suffix Search Order verification." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect Return
:CheckWINS ; REM *********************************************************************** ; REM ** ; REM ** Checks to make sure that the WINS settings are correct. If they are ; REM ** found to be incorrect the script edits the registry to insert the ; REM ** correct values. If the script has problems doing so (general error, ; REM ** user dosen't have rights to modify the registry, etc.) a message ; REM ** is sent to the system administrators alerting them to this fact. ; REM ** ; REM *********************************************************************** ; REM ** Local variables in use by this function are: $NetCard = " " $WINS1 = " " $WINS2 = " "
Select Case Ucase($Homesvr) = "HOFFPDC" $Site1 = $Hoffpdc $Site2 = $Hoffrad Case Ucase($Homesvr) = "MBANK" $Site1 = $Mbank $Site2 = $Hoffpdc Case Ucase($Homesvr) = "CTARF" $Site1 = $Ctarf $Site2 = $Hoffpdc Case Ucase($Homesvr) = "TTOWN" $Site1 = $Ttown $Site2 = $Hoffpdc Case Ucase($Homesvr) = "BWATER" $Site1 = $Bwater $Site2 = $Hoffpdc Case 1 $EmailMessage = "@WKSTA (@FULLNAME) Can't determine HOME SERVER. The current settings $homesvr. Please correct the settings on this system." Gosub SendAdminMail $Dummy = WriteLine (10, "$EmailMessage" + Chr(13) + Chr(10)) MessageBox ("The logon script could not determine your home server. A systems administrator has been notified of the problem.","Notice",4144) $Status = "Skipped " Return EndSelect
; REM ** Checks to see which ControlSet and Network Card is Current If ($OS = "WinNT4") $TempNumber = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\Select", "Current") $TempString = "ControlSet00"+$TempNumber $NetCard = EnumKey("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\NetBT\Adapters",0) EndIf
; REM ** Finds the WINS Server Settings Select Case $OS = "WinNT4" $WINS1 = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\NetBT\Adapters\$NetCard", "NameServer") $WINS2 = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\NetBT\Adapters\$NetCard", "NameServerBackup") Case (($OS = "Win95") OR ($OS = "Win98")) $WINS1 = ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer1") $WINS2 = ReadValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer2") Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting WINS verification." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect
; REM ** Checks the WINS Settings If (($WINS1 = $Site1) AND ($WINS2 = $Site2)) $Dummy = WriteLine (10, "Verified WINS Settings." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Else ; REM ** Sets the WINS settings correct if they are not $Dummy = WriteLine (10, "Old WINS Information: $WINS1 $WINS2" + Chr(13) + Chr(10)) Select Case $OS = "WinNT4" If (($Privilege = "Domain Admin") OR ($Privilege = "Local Admin")) $Dummy = WriteValue("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\NetBT\Adapters\$NetCard", "NameServer", $Site1, "REG_SZ") $Dummy = WriteValue("HKEY_LOCAL_MACHINE\SYSTEM\$TempString\Services\NetBT\Adapters\$NetCard", "NameServerBackup", $Site2, "REG_SZ") $Reboot = "WINS" $Dummy = WriteLine (10, "Updated WINS Settings" + Chr(13) + Chr(10)) $Status = "Updated " Else ;REM ** IF not correct then sends an alert. $EmailMessage = "@WKSTA (@FULLNAME) has incorrect WINS Settings. The current settings are $WINS1 and $WINS2. Please correct the settings on this system." Gosub SendAdminMail $Dummy = WriteLine (10, "$EmailMessage" + Chr(13) + Chr(10)) MessageBox ("Your WINS settings are INCORRECT but could not be changed automatically. A systems administrator has been notified of the problem.","Notice",4144) $Status = "Skipped " EndIf Case (($OS = "Win95") OR ($OS = "Win98")) $Dummy = WriteValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer1", $Site1, "REG_SZ") $Dummy = WriteValue("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP", "NameServer2", $Site2, "REG_SZ") $Reboot = "WINS" $Dummy = WriteLine (10, "Updated WINS Settings" + Chr(13) + Chr(10)) $Status = "Updated " Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting WINS verification." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect EndIf Return
:CheckIESettings ; REM *********************************************************************** ; REM ** ; REM ** Checks to make sure that Internet Explorer is correct. If incorrect, the ; REM ** script edits the registery to insert the correct value. If the ; REM ** script has problems doing so (general error, user doesn't have ; REM ** rights to modify the registry, etc.) a message is sent to the system ; REM ** administrators alerting them to this fact. ; REM ** ; REM *********************************************************************** ; REM ** Local variables in use by this function are: $IEProxy = " "
; REM ** Finds the IE Settings Select Case (($OS = "WinNT4") OR ($OS = "Win2k")) $IEProxy = ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer") Case (($OS = "Win95") OR ($OS = "Win98")) $IEProxy = ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer") Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting Internet Explorer verification." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect
; REM ** Checks IE Settings If ($IEProxy = "hoffexc:80") $Dummy = WriteLine (10, "Verified IE Settings." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Else ; REM ** Sets the IE settings correct If they are NOT $Dummy = WriteLine (10, "IE Settings Not Current" + Chr(13) + Chr(10)) Select Case (($OS = "WinNT4") OR ($OS = "Win2K")) If (($Privilege = "Domain Admin") OR ($Privilege = "Local Admin")) $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "00000001", "REG_DWORD") $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyHttp1.1", "00000001", "REG_DWORD") $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "EnableHttp1.1", "00000000", "REG_DWORD") $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "MigrateProxy", "00000001", "REG_DWORD") $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "hoffexc:80", "REG_MULTI_SZ") $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride", "<local>", "REG_MULTI_SZ") $Reboot = "IE Settings" $Dummy = WriteLine (10, "Updated Internet Explorer Settings" + Chr(13) + Chr(10)) $Status = "Updated " Else ;REM ** IF not correct then sends an alert. $EmailMessage = "@WKSTA (@FULLNAME) has incorrect Internet Explorer Settings. The current setting is $IEProxy. Please correct the settings on this system." Gosub SendAdminMail $Dummy = WriteLine (10, "$EmailMessage" + Chr(13) + Chr(10)) MessageBox ("Your Internet Explorer settings are INCORRECT but could not be changed automatically. A systems administrator has been notified of the problem.","Notice",4144) $Status = "Skipped " EndIf Case (($OS = "Win95") OR ($OS = "Win98")) $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "00000001", "REG_DWORD") $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyHttp1.1", "00000001", "REG_DWORD") $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "EnableHttp1.1", "00000000", "REG_DWORD") $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "MigrateProxy", "00000001", "REG_DWORD") $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "hoffexc:80", "REG_SZ") $Dummy = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride", "<local>", "REG_SZ") $Reboot = "IE Settings" $Dummy = WriteLine (10, "Updated Internet Explorer Settings" + Chr(13) + Chr(10)) $Status = "Updated " Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting Internet Explorer verification." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect EndIf Return
:CheckPasswordCaching ; REM *********************************************************************** ; REM ** ; REM ** Checks to see if the user has a password caching is disabled. ; REM ** ; REM ***********************************************************************
Select Case (($OS = "WinNT4") OR ($OS = "Win2k")) $Dummy = WriteLine (10, "$OS Does not require password caching to be disabled." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Case (($OS = "Win95") OR ($OS = "Win98")) $Cache = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK", "DisablePwdCaching") If $Cache <> "1" KeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK") If @ERROR = 0 Goto NOPWD Else Goto CONT EndIf Else $Dummy = WriteLine (10, "Verified Password Caching Settings." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " EndIf Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting password caching verification." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect Return
:CONT KeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES") If @ERROR = 0 Goto NETWORK Else AddKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES") EndIf
:NETWORK KeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK") If @ERROR = 0 Goto NOPWD Else AddKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK") EndIf Goto NOPWD
:NOPWD ? "Adding no password cache" KeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK") If @ERROR = 0 ; ? "Updating No password cache" WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK", "DisablePwdCaching","1","REG_SZ") $Dummy = WriteLine (10, "Disabled Password Caching." + Chr(13) + Chr(10)) $Status = "Updated " Else EndIf Return
:ConfOutlook ; REM *********************************************************************** ; REM ** ; REM ** Checks to see if the user has a outlook profile on the local ; REM ** system, and if not creates it. ; REM ** ; REM *********************************************************************** $hklms = 'HKEY_LOCAL_MACHINE\SOFTWARE' $hkcus = 'HKEY_CURRENT_USER\SOFTWARE' $Profile_Remove = "No" ; -- If set to Yes, it will remove profiles other than @USERID, like OEM User, MS Exchange Settings, etc. $DeleteItems = "Yes" ; -- Do you want your users to delete all deleted items on Exit from Outlook? $exserver = " " $Profname = SubStr(@FULLNAME,1,1)+" "+SubStr(@FULLNAME,InStr(@FULLNAME," ")+1,1) ; -- Get User Initials
Select Case Ucase($Homesvr) = "HOFFPDC" $Exserver = $Hoffexc Case Ucase($Homesvr) = "MBANK" $Exserver = $Mbank Case Ucase($Homesvr) = "CTARF" $Exserver = $Ctarf Case Ucase($Homesvr) = "TTOWN" $Exserver = $Ttown Case Ucase($Homesvr) = "BWATER" $Exserver = $Bwater Case 1 $EmailMessage = "@WKSTA (@FULLNAME) Can't determine HOME SERVER. The current settings $homesvr. Please correct the settings on this system." Gosub SendAdminMail $Dummy = WriteLine (10, "$EmailMessage" + Chr(13) + Chr(10)) MessageBox ("The logon script could not determine your home server. A systems administrator has been notified of the problem.","Notice",4144) $Status = "Skipped " Return EndSelect
Select Case (($OS = "WinNT4") OR ($OS = "Win2k")) $profilelocation = $hkcus+"\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" If 1 <> Exist("%userprofile%"+"\WINNT.PRF") Copy @LDRIVE+"Winnt.prf" "%userprofile%\WINNT.PRF" EndIf $winntfile = "%UserProfile%\Winnt.prf" Case (($OS = "Win95") OR ($OS = "Win98")) $profilelocation = $hkcus+"\Microsoft\Windows Messaging Subsystem\Profiles" If 1 <> Exist("%userprofile%"+"\WINNT.PRF") Copy @LDRIVE+"Winnt.prf" "%windir%\WIN95.PRF" EndIf $winntfile = "%Windir%\Win95.prf" Case 1 $Dummy = WriteLine (10, "Unknown operating system, aborting outlook configuration." + Chr(13) + Chr(10)) $Status = "Aborted " Return EndSelect $personalprofilelocation = $profilelocation+"\"+"$Profname"
; -- Now that we have created the appropriate Keys and Registry Values, Let's Generate the user's Profile ;If 1 <> Exist("$Datapath\PROFGEN.exe") ; Copy @LDRIVE+"PROFGEN.EXE" "$Datapath"+"PROFGEN.EXE" ;EndIf If 1 <> Exist("$Datapath\NEWPROF.EXE") Copy @LDRIVE+"NEWPROF.EXE" "$Datapath"+"NEWPROF.EXE" EndIf If 1 <> Exist("$Datapath\FixPrf.exe") Copy @LDRIVE+"FixPrf.exe" "$Datapath"+"FixPrf.exe" EndIf
; -- If we open WINNT.PRF in a TEXT Editor, ; -- we notice that it is structured the same as an INI file
$profilename = ReadProfileString($winntfile,"General","ProfileName")
If $profilename <> "$Profname" $ = WriteProfileString($winntfile,"General","ProfileName",Chr(37)+"$Profname"+Chr(37)) EndIf
If $exserver <> ReadProfileString($winntfile,"Service2","HomeServer") $ = WriteProfileString($winntfile,"Service2","HomeServer",$exserver) EndIf
$mailboxname = ReadProfileString($winntfile,"Service2","MailboxName")
If $mailboxname <> "@userid" OR $mailboxname = "$USERNAME$" $ = WriteProfileString($winntfile,"Service2","MailboxName",Chr(37)+"username"+Chr(37)) EndIf
; -- If the userid exists, we don't want to mess with it If 1 = KeyExist( $personalprofilelocation ) $Dummy = WriteLine (10, "Verified Outlook Profile Settings." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Return EndIf
If $Profile_Remove = "YES" ; -- If it does not exist, delete out any odd-ball Profiles ; -- Like OEM user, etc. $index = 0 :loop3 $keyname = EnumKey($profilelocation, $index) If @error = 0 ;? "Name found: $KeyName" ; -- Uncomment for debugging ; -- Going to check for @userid If $keyname <> @userid OR $keyname <> "Sales" $rc = DelTree($profilelocation+"\"+$keyname) ;$RC = DELKEY($ProfileLocation, $KeyName) $index = $index + 1 Goto Loop3 EndIf EndIf EndIf ; -- Generate the Inbox ; -- Make sure you use PUTINENV.EXE and WINSET.EXE with 9x machines - We need to have the %USERNAME% available ; -- "Secondary Inbox" is an alternate to keep $returncode= KeyExist($personalprofilelocation); OR KeyExist($profilelocation+"\Secondary Inbox") ;?$ReturnCode ; -- Uncomment for debugging If $returncode <> 1 ;Edit the copied mail profile to make it the userid. ;run "%WINDIR%\fixpatch.exe @USERID" ;The quotes here are important with Windows 2000 Machines as the user profile is ;under \DOCUMENTS AND SETTTINGS\USERID and KIX appears to not like spaces in file/folder names $Fixprf = "$Datapath"+"Fixprf.exe" Run '$Fixprf "$winntfile" @userid "$Profname" $ExServer' ; -- Had to add a small pause Sleep 1 $Newprof = "$Datapath"+"Newprof.exe" Run '$Newprof -p "$winntfile" -x' ;If you want to use PROFGEN, uncomment the next line and comment the one for FIXPRF.EXE ;RUN '%WINDIR%\PROFGEN.EXE %WINDIR%\NEWPROF.EXE -P "%UserProfile%\WINNT.PRF" @userid -r -l' ;Write new default mail profile based on USERID ;Had to add a small pause for this next step Sleep 1 $ = WriteValue($profilelocation, "DefaultProfile", "$Profname", "REG_SZ") EndIf
; -- Check for the Default profile, if it does not exist, create it If @userid <> ReadValue( $profilelocation, "DefaultProfile" ) $ = WriteValue ($profilelocation, "DefaultProfile", "$Profname", "REG_SZ") EndIf
; -- Check the box to empty deleted items on leaving Outlook - Now the we have the Outlook Profile Generated If $DeleteItems = "Yes" If "0100" <> ReadValue($personalprofilelocation+ "\0a0d020000000000c000000000000046","000b0115") $ = WriteValue($personalprofilelocation+ "\0a0d020000000000c000000000000046","000b0115","0100","REG_BINARY") EndIf EndIf
If 1 <> KeyExist($personalprofilelocation) ; -- Check for Outlook Version 9.x (Office 2000) $exe=ReadValue($hklms+"\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE","") $ver=GetFileVersion("$exe") $verchk = SubStr ($ver, 1, 1) If $verchk = "9" ; -- If it is Outlook 2000, configure the following keys and values ; -- CHECK FOR KEYS AND IF NEED BE, ADD THEM If 1 <> KeyExist($hkcus+"\Microsoft\Office\9.0") $ = AddKey($hkcus+"\Microsoft\Office\9.0") EndIf If 1 <> KeyExist($hkcus+"\Microsoft\Office\9.0\Common") $ = AddKey($hkcus+"\Microsoft\Office\9.0\Common") EndIf If 1 <> KeyExist($hkcus+"\Microsoft\Office\9.0\Common\UserInfo") $ = AddKey($hkcus+"\Microsoft\Office\9.0\Common\UserInfo") EndIf If 1 <> KeyExist($hkcus+"\Microsoft\Office\9.0\Outlook") $ = AddKey($hkcus+"\Microsoft\Office\9.0\Outlook") EndIf If 1 <> KeyExist($hkcus+"\Microsoft\Office\9.0\Outlook\Setup") $ = AddKey($hkcus+"\Microsoft\Office\9.0\Outlook\Setup") EndIf If 1 <> KeyExist($hkcus+"\Microsoft\Office\9.0\Outlook\Office Explorer") $ = AddKey($hkcus+"\Microsoft\Office\9.0\Outlook\Office Explorer") EndIf ; -- NEW KEYS ; -- Company ;$ = WriteValue($hkcus+"\Microsoft\Office\9.0\Common\UserInfo","Company", "0000000000000000000000000000000000000000000000000000000000000000000000000","REG_BINARY") ; -- Changes the view to get rid of the Outlook Bar and show the "Explorer View" ;$ = WriteValue($hkcus+"\Microsoft\Office\9.0\Outlook\Office Explorer","Frame", "010000002c0000000200000003000000ffffffffffffffffffffffffffffffff62000000270000003c030000ac02000001000000000000000100000000000000c0000000 6400000003000000","REG_BI NARY") ; -- Set the Machine Name If @WKSTA <> ReadValue($hkcus+"\Microsoft\Office\9.0\Outlook","Machine Name") $ = WriteValue($hkcus+"\Microsoft\Office\9.0\Outlook","Machine Name",@WKSTA,"REG_SZ") EndIf ; -- Check Internet E-Mail Accounts If 1 <> ReadValue($hkcus+"\Microsoft\Office\9.0\Outlook","CheckInternetAccounts") $ = WriteValue($hkcus+"\Microsoft\Office\9.0\Outlook","CheckInternetAccounts","1","REG_DWORD") EndIf ; -- Mail Type - is it Corporate or POP3? If 1 <> ReadValue($hkcus+"\Microsoft\Office\9.0\Outlook\Setup","MailSupport") $ = WriteValue($hkcus+"\Microsoft\Office\9.0\Outlook\Setup","MailSupport","1","REG_DWORD") EndIf ; -- Has Outlook been Setup? If "False" <> ReadValue($hkcus+"\Microsoft\Office\9.0\Outlook","FirstRunDialog") $ = WriteValue($hkcus+"\Microsoft\Office\9.0\Outlook","FirstRunDialog","False","REG_SZ") EndIf EndIf EndIf $Dummy = WriteLine (10, "Outlook Configured for @USERID on @WKSTA." + Chr(13) + Chr(10)) $Status = "Updated " Return
:CheckMcAfee ; REM *********************************************************************** ; REM ** ; REM ** Checks to see if McAfee anti-virus is installed and if the virus ; REM ** signatures are the most current. ; REM ** ; REM *********************************************************************** ; REM ** Local variables in use by this function are:
$AVCurrentVersion="4.5.1" ; REM ** Current version of anti-virus software $AVVersion = " " ; REM ** Currently installed version of anti-virus software $SourceDat = "@LDRIVE"+"$CurrentDat" $DestDat = "$Datapath"+"$CurrentDat" $TempStr = " " If (KeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\VirusScan") = 1) $AVVersion =ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\VirusScan", "szCurrentVersionNumber") Else $EmailMessage = "@USERID (@FULLNAME) on computer @WKSTA needs to have Mcafee anti-virus installed." $Dummy = WriteLine (10, "$EmailMessage" + Chr(13) + Chr(10)) Gosub SendAdminMail $Status = "Skipped " Return EndIf If ($AVVersion = $AVCurrentVersion) ; REM ** Don't update the local signatures if the client software hasn't been updated yet. $TempString = Exist($DestDat) Select Case $TempString = 1 $Dummy = WriteLine (10, "Verified Mcafee anti-virus signature version." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Case $TempString = 0 $EmailMessage = "@USERID on computer @WKSTA has a old version of Mcafee anti-virus signatures (Copy $SourceDat $DestDat)" $Dummy = WriteLine (10, "$EmailMessage" + Chr(13) + Chr(10)) Del "$Datapath"+"*xdat.exe" Del "$Datapath"+"sdat*.exe" Copy $SourceDat $DestDat Run "$DestDat /SILENT /PROMPT" $Status = "Updated " Case 1 ; REM ** This will also copy the updates if the update file is not found on the local client system. $Dummy = WriteLine (10, "Mcafee anti-virus signatures are uptodate." + Chr(13) + Chr(10)) $Status = "Skipped " EndSelect Else $EmailMessage = "@USERID (@FULLNAME) on computer @WKSTA needs to have Mcafee anti-virus software updated from v$AVVersion to v$AVCurrentVersion." $Dummy = WriteLine (10, "$EmailMessage" + Chr(13) + Chr(10)) Gosub SendAdminMail $Status = "Skipped " EndIf Return
:CheckTemp ; REM *********************************************************************** ; REM ** ; REM ** Checks to see if Temp direectory is installed and if it needs clearing ; REM ** ; REM *********************************************************************** ; REM ** Local variables in use by this function are: $tempdir = "$Datapath"+"\"+"temp1.dat" $tempfile = "$Datapath"+"\"+"temp2.dat" Dim $tempdir_data[99999]
Shell "%comspec% /c dir %temp% /ad /b /s > $tempdir" Shell "%comspec% /c dir %temp% /a-d /b /s > $tempfile"
; **REM Kill_Files $q = Open(1,$tempfile) $tempfile_data = ReadLine(1) While @error = 0 Del $tempfile_data $tempfile_data = ReadLine(1) Loop $q = Close(1)
; **REM Kill_directories $array_count = 0 $q = Open (1,$tempdir) $tempdir_data[$array_count] = ReadLine(1)
While $tempdir_data[$array_count] <> "" $array_count = $array_count + 1 $tempdir_data[$array_count] = ReadLine(1) Loop $q = Close(1)
RD $tempdir_data[$array_count] While $array_count >= 0 RD $tempdir_data[$array_count] $array_count = $array_count - 1 Loop
Del $tempdir Del $tempfile
$Dummy = WriteLine (10, "Verified Temp Directory is clear." + Chr(13) + Chr(10)) $Status = " " + Chr(251) + " OK " Return
: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 $ADIntalled = 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"
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|