**DONOTDELETE**
(Lurker)
2001-08-17 11:03 PM
HELP PLEASE

I would like to know how I can put a string in my kix script that will be added to the registry's runonce so that the command can execute at windows bootup.

the string that will be added to the registry, and it's fnction is to renames a file._bk to file.dll in the c:\windows\system32 directory.

Can someone help please

NTDOCAdministrator
(KiX Master)
2001-08-18 01:48 AM
Re: HELP PLEASE

Hello Wal,

How about something like this:

code:
IF @INWIN=2 ; Windows 9x systems
IF (EXIST("%WINDIR%\wininit.ini") = 1)
?"System requires a restart to complete previously installed software..."
ELSE
$SF = %WINDIR%
WRITEPROFILESTRING("%windir%\wininit.ini","RENAME","$SF\file.dll","$SF\file._bk")
ENDIF
ENDIF



**DONOTDELETE**
(Lurker)
2001-08-18 05:19 AM
Re: HELP PLEASE

what I am doing is removing mcafee and when I do that, after the reboot it renames the c:\windows\system32\shlwapi.dll FOR WINNT
c:\windows\system32\shlwapi.dll FOR WIN9X

to shlwapi._bk
Now that causes some windows program not to work like Internet explorer.

What I want to do is after my script runs and I reboot the computer I want to rename that file back to shlwapi.dll so I don't get error messages.
and I thought that using the runonce in my script would do that.

Any ideas

NTDOCAdministrator
(KiX Master)
2001-08-18 10:43 AM
Re: HELP PLEASE

This method does rename files during the reboot. Give it a try and let me know.

code:
IF @INWIN=2 ; Windows 9x systems
IF (EXIST("%WINDIR%\wininit.ini") = 1)
?"System requires a restart to complete previously installed software..."
ELSE
$SF = %WINDIR%
WRITEPROFILESTRING("%windir%\wininit.ini","RENAME","$SF\system\shlwapi.dll","$SF\system\shlwapi._bk")
ENDIF
ENDIF

IF @INWIN=1 ; Windows NT systems
IF (EXIST("%WINDIR%\wininit.ini") = 1)
?"System requires a restart to complete previously installed software..."
ELSE
$SF = %WINDIR%
WRITEPROFILESTRING("%windir%\wininit.ini","RENAME","$SF\system32\shlwapi.dll","$SF\system32\shlwapi._bk")
ENDIF
ENDIF




**DONOTDELETE**
(Lurker)
2001-08-18 09:39 PM
Re: HELP PLEASE

I tried it but it did not rename the shlwapi._bk to shlwapi.dll

so when windows booted it gave me the message that the file is missing.

this is what was added to the wininit.ini
$SF\system\shlwapi.dll=$SF\system\shlwapi._bk

NTDOCAdministrator
(KiX Master)
2001-08-20 10:39 AM
Re: HELP PLEASE

Hello Wal,

Please post the exact code that you used. The $SF is a variable to get the current directory for Windows 9x or NT. Perhaps you are missing a part of the code I wrote.

I tested it on a couple of systems and the code posted appears to work fine on these systems.

Please post your code and I will take a look at it for you to see what may be missing...

[ 20 August 2001: Message edited by: NTDOC ]

LonkeroAdministrator
(KiX Master Guru)
2001-08-20 11:11 AM
Re: HELP PLEASE

doc, have you tested this script?
there are two might be's I encountered when I looked at this topic approx. 5secs.
so can't be sure but. one thing is that wal didn't use whole script (lacking the line $sf = %windir). other is what I think is the cause, uttleast some versions of kix does not allow variable used in that way in scripts. and not even one version should (like kix-doc's say).
so the line:
WRITEPROFILESTRING("%windir%\wininit.ini","RENAME","$SF\system32\shlwapi.dll","$SF\system32\shlwapi._bk")

should be:
WRITEPROFILESTRING("%windir%\wininit.ini","RENAME","$SF"+"\system32\shlwapi.dll","$SF"+"\system32\shlwapi._bk")

cause there ain't such variable named as:
$SF\system32\shlwapi._bk

anyways, I might myself use
WRITEPROFILESTRING("%windir%\wininit.ini","RENAME","%windir%\system32\shlwapi.dll","%windir%\system32\shlwapi._bk")

and this way avoid totally the use of $sf.

just my 1.5 cents...

NTDOCAdministrator
(KiX Master)
2001-08-20 11:42 AM
Re: HELP PLEASE

true, true... I thought of the %windir%, but wrote the $SF first. Also, this may not work for NT/2000 I only tested it on a Win95 and Win98 box.

I am using KiXtart v3.63

Wal,

Please post your code so we can look, and if it does not work we may have to look at another way. Not sure the RUN ONCE will work or not... depends if the .DLL get loaded or not first.

Don't worry though, it can be done one way or another...

**DONOTDELETE**
(Lurker)
2001-08-20 03:49 PM
Re: HELP PLEASE

Hi guys,
This is the code all works fine only I am not sure how to bypass the shlwapi file that mcafee renames to ._bk i tried to do it in the runonce but the file is used at the time that the runonce execute. DOC your code worked but I don't know why on NT4 using IE5
I get this problem.

Anyhow,

Thanks in advance.

BREAK ON
CLS

;Variable Declaration Section
;----------------------------------------------------------------------------------------------------------------

$UninstNT = ("C:\PROGRA~1\NETWOR~1\VIRUSS~1\SETUP.EXE /NODIALOG -SMS -fC:\PROGRA~1\NETWOR~1\VIRUSS~1\UNINST.INS")
$Uninst9x = ("C:\PROGRA~1\NETWOR~1\MCAFEE~1\SETUP.EXE /nodialog -SMS -fC:\PROGRA~1\NETWOR~1\MCAFEE~1\uninst.ins")

$User = @USERID
$Dos = @DOS
$Fname = @FULLNAME
$Host = @HOSTNAME

$NewName = ($User + ".log")

$Logdir = "%windir%"

$LogName = ($Logdir + "\" +$NewName)

;----------------------------------------------------------------------------------------------------------------

; Uninstalling 4.03 can sometimes cause problems with SHLWAPI.dll file used by Internet Explorer 5.x

SELECT

CASE @INWIN = 1

;copy "%windir%\system32\shlwapi.dll" "%windir%\system32\shlwapi._bk"
GOTO WIN_NT

CASE @INWIN = 2

;copy "%windir%\system\shlwapi.dll" "%windir%\system\shlwapi._bk"
GOTO WIN9x

CASE 1
GOTO THEEND ; Operating system not recognized
ENDSELECT

:WIN9x

IF @INWIN = 2 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; If OS is Windows 9X ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

IF EXIST ("C:\PROGRA~1\NETWOR~1\MCAFEE~1\uninst.ins")

OPEN(2,$LogName,5)
Writeline(2,"File: C:\PROGRA~1\NETWOR~1\MCAFEE~1\uninst.ins Found:" +Chr(13) +Chr(10) + "Proceeding with Silent UnInstall........ "+Chr(13) +Chr(10))
CLOSE(2)

"UNINSTALLING MCAFEE 4.03...PLEASE WAIT."
SHELL $Uninst9x

; Verifies to make sure that the uninstall is complete SOME WORK TO CHECK HERE
SELECT ; evaluate error code

CASE @ERROR = 259
cls
"MCAFEE 4.03 UNINSTALL ON WINDOWS 9X IS COMPLETE."

CASE @ERROR <> 259
cls
"AN ERROR OCCURED WHILE UNINSTALLING MCAFEE. WRITING ERROR TO LOG FILE...."
OPEN(2,$LogName,5)
Writeline(2,"Error Code was: " + @error + Chr(13) +Chr(10) + "Uninstall Failed" + Chr(13) +Chr(10) + $User+Chr(13) +Chr(10) + $Dos+Chr(13) +Chr(10) + $Fname+Chr(13) +Chr(10) + $Host+Chr(13) +Chr(10) + @DATE + " " + "SUCCESSFULLY UNINSTALLED MCAFEE" + " " + @TIME + Chr(13) + Chr(10))
Close(2)

ENDSELECT
OPEN(2,$LogName,5)
Writeline(2," End evaluate @error condition ..." +Chr(13) +Chr(10) + "Proceeding with EPO Agent Install........ "+Chr(13) +Chr(10))
CLOSE(2)
GOTO RUNEPO ; Go to Label to start EPO agent installation for either OS
ELSE
GOTO THEEND

ENDIF ;End condition for IF EXIST ("C:\PROGRA~1\NETWOR~1\VIRUSS~1\uninst.ins")


:WIN_NT

IF @INWIN = 1 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;If OS is Windows NT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

IF EXIST ("C:\PROGRA~1\NETWOR~1\VIRUSS~1\uninst.ins")

"UNINSTALLING MCAFEE 4.03...PLEASE WAIT."
SHELL "%COMSPEC% /C $UninstNT"

SELECT

CASE @ERROR = 0 ;;;;;;;;;;;;;If the Uninstall is Successfull

cls
"MCAFEE 4.03 UNINSTALL ON WINDOWS NT IS COMPLETE."
OPEN(2,$LogName,5)
Writeline(2,$User+Chr(13) +Chr(10) + $Dos+Chr(13) +Chr(10) + $Fname+Chr(13) +Chr(10) + $Host+Chr(13) +Chr(10) + @DATE + " " + "SUCCESSFULLY UNINSTALLED MCAFEE" + " " + @TIME + Chr(13) + Chr(10))
Close(2)

CASE @ ERROR <> 0 ;;;;;;;;;;;;;If the Uninstall is not Successfull
cls
"AN ERROR OCCURED WHILE UNINSTALLING MCAFEE. WRITING ERROR TO LOG FILE...."
OPEN(2,$LogName,5)
Writeline(2,"Error Code was: " + @error + Chr(13) +Chr(10) + "Uninstall Failed" + Chr(13) +Chr(10) + $User+Chr(13) +Chr(10) + $Dos+Chr(13) +Chr(10) + $Fname+Chr(13) +Chr(10) + $Host+Chr(13) +Chr(10) + @DATE + " " + "SUCCESSFULLY UNINSTALLED MCAFEE" + " " + @TIME + Chr(13) + Chr(10))
Close(2)

ENDSELECT
OPEN(2,$LogName,5)
Writeline(2," End evaluate @error condition ..." +Chr(13) +Chr(10) + "Proceeding with EPO Agent Install........ "+Chr(13) +Chr(10))
CLOSE(2)
GOTO RUNEPO ; Go to Label to start EPO agent installation for either OS

ELSE
GOTO THEEND

ENDIF ;End condition for IF EXIST ("C:\PROGRA~1\NETWOR~1\VIRUSS~1\uninst.ins")


:RUNEPO
IF @INWIN=2 ; Windows 9x systems
IF (EXIST("%WINDIR%\wininit.ini") = 1)
$SF = %WINDIR%
WRITEPROFILESTRING("%windir%\wininit.ini","RENAME","$SF\system\shlwapi.dll","$SF\system\shlwapi._bk")
?"System requires a restart to complete previously installed software..."
ELSE
$SF = %WINDIR%
WRITEPROFILESTRING("%windir%\wininit.ini","RENAME","$SF\system\shlwapi.dll","$SF\system\shlwapi._bk")
ENDIF
ENDIF

IF @INWIN=1 ; Windows NT systems
IF (EXIST("%WINDIR%\wininit.ini") = 1)
$SF = %WINDIR%
WRITEPROFILESTRING("%windir%\wininit.ini","RENAME","$SF\system32\shlwapi.dll","$SF\system32\shlwapi._bk")
?"System requires a restart to complete previously installed software..."
ELSE
$SF = %WINDIR%
WRITEPROFILESTRING("%windir%\wininit.ini","RENAME","$SF\system32\shlwapi.dll","$SF\system32\shlwapi._bk")
ENDIF
ENDIF


;run the agent install
SHELL "%windir%\poaginst.exe"
SLEEP 3
cls
$Getout = MessageBox("The computer must reboot for settings to take effect. Click OK to reboot.", "Rebooting", 4112) ; try 36 if necessary
If $Getout = 1
RUN "%windir%\Reboot.exe" ; reboot PC
endif

:THEEND
EXIT

LonkeroAdministrator
(KiX Master Guru)
2001-08-20 04:08 PM
Re: HELP PLEASE

what about syncing the logonscript? then it might not be used...
or, if you want to prevent it from being changed, use open().
it can't be changed if it is exclusively opened by your kix-process.

well these are my 0.32 cents...

**DONOTDELETE**
(Lurker)
2001-08-20 04:40 PM
Re: HELP PLEASE

Well see the changes take effect during the reboot, so the file is not in use at that time.

LonkeroAdministrator
(KiX Master Guru)
2001-08-20 05:13 PM
Re: HELP PLEASE

well,
I got it done like this. I killed process explorer.exe
and renamed/deleted file.
worked fine. then just rerun explorer or logon again.


**DONOTDELETE**
(Lurker)
2001-08-20 05:34 PM
Re: HELP PLEASE

could you send me the code please.

NTDOCAdministrator
(KiX Master)
2001-08-20 09:10 PM
Re: HELP PLEASE

What is poaginst.exe ?

I assume you are changing the Antivirus program being used by your company...

Sorry, I don't have McAfee installed any more, so I'm not sure what you mean by Windows 95 works but NT has a problem.
What problem does NT have that Windows 95 does not? This file name change?

I don't remember having this problem when I removed McAfee a year ago from our systems.

Sounds like Lonkero may know what your experiencing and perhaps he can shed some light and code for you.

Otherwise I will have to break out my McAfee Killer --- and see if it can be updated.

**DONOTDELETE**
(Lurker)
2001-08-20 11:39 PM
Re: HELP PLEASE

No worries DOc I was able to find out what string in the registry mcafee was removing so I deleted it it and created my own registry patch to correct the problem.

Thanks for all the help

IT'S BEER TIME.