I had have lots of problem deploying our newest Java version through our GPO.

When deploying newest Java 7 update 21 MSI packages the installer hangs on forever in the windows logon screen uninstalling the last Java version.

This problem is because that inside the Java 7 packages it deletes first half of the Java folder and deletes the essential java installer.dll file from the installation that are needed for the Java installation.

The Java installation needs installer.dll located in

C:\Program Files\Java\jre7\bin\installer.dll\ installer.dll

The problem is that for few computers that installer.dll is already missing, before the java msi package has been deployed into gpo.

So naturally I thought the solution to fix this is to make a cmd script to create/xcopy the file and folders to right place.

Here is my script I have been working at

REM @echo OFF
if exist c:\appdep\java.txt goto exit
:: if exist "C:\Program Files\Java goto remove else install
:: if exist "C:\Program Files\Java goto uinstall else install
echo now uinstalling
del /f /s /q  "C:\Program Files\Java\*.*"
rmdir /s /q "C:\Program Files\Java"
del /f /s /q  "C:\Users\%username%\AppData\LocalLow\Sun\*.*"
rmdir /s /q   "C:\Users\%username%\AppData\LocalLow\Sun"
 wmic product where (name like "%%Java%%") call uninstall
echo now installing java 7 update 21
mkdir "C:\Program Files\Java
mkdir "C:\Program Files\Java\jre7
net use
net use /p:yes
net use s: \\network_share\network_share\Java Runtime\jre7u21\jre7" /persistent:no
net use
xcopy "\\network_share\network_share\Java Runtime\jre7u21\jre7" "C:\Program Files\Java\jre7" /e /i /h /f
copy  "\\network_share\network_share\Java Runtime\jre7u21\jre7\bin\installer.dll" "C:\Program Files\Java\jre7\bin\installer.dll"
msiexec /i "\\network_share\Java Runtime\jre7u21\jre1.7.0_21.msi" /norestart /quiet
xcopy "\\network_share\Java Runtime\java.txt" "c:\appdep\" /y
echo Java 7 update 21 installed, Great success!
First problem I encountered in the script that uac/admin rights are needed on standard computer.

Make some research to lunch cmd file as admin with the password inside the cmd file. First thing I found was the runas command, but it wonít work because you canít save in plain text the password.

The next thing I tried, was the lsrunas.exe ďhere is the link of the program and commandsĒ

lsrunas : runas and passing the password (sanur replacement)

Found out pretty fast it can only lunch exe files sow I tried to convert the cmd to exe and after that lunch the cmd program, but again no success. UAC was there again even I had a admin and password put in the cmd file.

More explained that I want to do is to lunch this cmd file through netlogon.bat with admin rights.

And regarding Java msi packages already tried this.

How to get java.msi for GPO-deployment

Of some reason the packages donít work.

Another thing I could also add here that I have 150 computers that has randomly Java 7 update 13,15,17,21.

I really donít want to go through installing 150 computers manually.

Hopefully I put this in the right forum and explained clearly what I want to do.