Remotely and Silently Update Java on Windows 7, 8, & 10

code1

Keeping Java updated in the enterprise network can be difficult because of the frequencies of updates released. This script removes any old versions installed and then installs version 8.77. It also turns off auto updating.

You need to download the offline Java installer and then edit Java32 and Java64 variables for your environment. I have tested and used this script with Java version 8.77. Future builds may need tweaks. Happy Updating!

Code:

@ECHO OFF

set Java32=“\\NETWORK LOCATION\jre-8u77-windows-i586.com”
set Java64=“\\NETWORK LOCATION\jre-8u77-windows-x64.com”

goto uninstall

:uninstall
@ECHO OFF
cls

wmic product where “name like ‘Java 7%%'” call uninstall /nointeractive
wmic product where “name like ‘JavaFX%%'” call uninstall /nointeractive
wmic product where “name like ‘Java(TM) 7%%'” call uninstall /nointeractive
wmic product where “name like ‘Java(tm) 6%%'” call uninstall /nointeractive
wmic product where “name like ‘J2SE Runtime Environment%%'” call uninstall /nointeractive
wmic product where “name like ‘Java 8%%'” call uninstall /nointeractive
wmic product where “name like ‘Java(TM) 8%%'” call uninstall /nointeractive

if not exist %Java32% set missing=%Java32% & goto Julia1
if not exist %Java64% set missing=%Java64% & goto Julia1

IF NOT DEFINED PROCESSOR_ARCHITEW6432 (
IF %PROCESSOR_ARCHITECTURE% EQU x86 (
goto JA32
) ELSE (
goto JA64
)) ELSE (
goto JA64
)
:JA64
cls
title Installing Java x64
echo Installing Java x64. . .
%Java64% INSTALL_SILENT=1 STATIC=0 REBOOT=0 AUTO_UPDATE=0 EULA=0 WEB_ANALYTICS=0 WEB_JAVA=1

REM Disable Java Update Tab and also Updates and Notifications
reg add “HKLM\SOFTWARE\JavaSoft\Java Update\Policy” /v EnableJavaUpdate /t REG_DWORD /d 00000000 /f
reg add “HKLM\SOFTWARE\JavaSoft\Java Update\Policy” /v EnableAutoUpdateCheck /t REG_DWORD /d 00000000 /f
reg add “HKLM\SOFTWARE\Wow6432Node\JavaSoft” /v SPONSORS /t REG_SZ /d DISABLE /f
goto JA32

:JA32
cls
title Installing Java x86
echo Installing Java x86. . .

%Java32% INSTALL_SILENT=1 STATIC=0 REBOOT=0 AUTO_UPDATE=0 EULA=0 WEB_ANALYTICS=0 WEB_JAVA=1

REM Disable Java Update Tab and also Updates and Notifications
reg add “HKLM\SOFTWARE\JavaSoft\Java Update\Policy” /v EnableJavaUpdate /t REG_DWORD /d 00000000 /f
reg add “HKLM\SOFTWARE\JavaSoft\Java Update\Policy” /v EnableAutoUpdateCheck /t REG_DWORD /d 00000000 /f
reg add “HKLM\SOFTWARE\JavaSoft” /v SPONSORS /t REG_SZ /d DISABLE /f

goto END

:Julia1
cls
echo Bad Path
echo.
goto END

:END
exit

You can download a text file with the code here: java2

Windows 7, 8, and 10 Auto & Script

Make a new .Reg file with the code below and merge it to your registry to enable auto login on Windows 7, 8, 10, & 11.

Code:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
 “DefaultUserName”=”username”
“DefaultPassword”=”password”
“DefaultDomainName”=”domain”
“AutoAdminLogon”=”1”
“ForceAutoLogon”=”1”

Update the username, password, and domain fields for your needs. To bypass auto login once installed hold down the shift key while the PC is booting.

Moving a file share to a new server.

A simple way to move file shares from one server to another with the ability to copy NTFS permissions. Run the script as a domain admin and make sure the owner of all the files is the domain admin.

Start the script with a scheduled task during the night and change your login script for a seamless move.

–>Download and install Robocopy if needed. (It is part of the Windows Server Resource Kit Tool and or it is a standard feature in Server 2008)
For more info on Robocopy check out: http://en.wikipedia.org/wiki/Robocopy

Code:

robocopy \\oldserver\share\ \\newserver\share /s /e /copy:DATSOU

Change local admin passwords remotely. Quick, Simple, Effective!

This uses the pspasswd tool from Microsoft. Go to http://technet.microsoft.com/en-us/sysinternals and then download and copy it to your c:\windows\system32\ directory.

Then create two files “Machinelist.txt” and a batch file with the code below. Populate the “Machinelist.txt” with PC names you wish to change the local admin passwords on; one PC per line. Then edit the batch file with the correct credentials and the new password information. Make sure the machines are online and then run the script. You need to use an account with domain administrator rights for the –u and –p parameters in order for this to run correctly.

Quick, Simple, Effective!

Code:

pspasswd.exe @machinelist.txt -u domain\administrator -p domainpassword administrator newpassword
echo “Complete”
pause