Categoryscripting

Silent Install of Java 7 Update 40

1. Download the Java update from java.com.

2. The file you download will be an EXE. To get silent installations with some additional features you will need to pull the MSI from within the EXE.

To accomplish this, run the EXE on a test computer. (Just double click the EXE and move to the next step).

When the installation wizard starts, DO NOT proceed. By starting the installation wizard you have caused the Java MSI to be extracted to a special directory on you workstation.

To find this directory open your run command and type in %LOCALAPPDATA% and hit enter. This will open a window to your appdata\local directory. Go back one level and go into LocalLow. Inside this directory you’ll see a subdirectory called Sun. Drill down into the Sun\Java directory until you see the jre1.7.0_40 directory. This directory contains the Java .msi and .cab files needed for the Java installation.

3. Copy the jre1.7.0_40 directory  to another directory on your computer. After the copy you can cancel out of the Java install wizard that you started a minute ago.

4. Assuming you copied the jre1.7.0_40 folder to c:\temp, issue the following commands:

cd c:\temp
msiexec /i c:\temp\jrel.7.0_40.msi allusers=1 /q /norestart ju=0 javaupdate=0 rebootyesno=no

ONE VERY BIG note. If you receive an error 1603 when deploying to some computers, that’s a sign that the computers may have had some Java applets running. This is usually the case when they have browsers that are running.

If you hit errors on your deployment you may want to try adding addtional steps to kill browser sessions.

Java installation errors (1603, 1618)

If you get errors (1603, 1618) then you will want to consider removing older Java entries. This is done by removing the keys in the registry. It’s an involved process that sys admins love to hate.

Where Is the Startup Folder?

I was recently searching for the startup folder for the User profile and the All Users profile in Windows 7. Systems administrators frequently create scripts which must run at login. Sometimes the scripts target an individual user profile and other times they target the computer in general regardless of the user.

In Windows XP, the startup folder existed in the following locations:

User Profile
 C:\Documents and Settings\Start Menu\Programs\Startup

All Users Profile
 C:\Documents and Settings\All Users\Start Menu\Programs\Startup

In Windows 7 however, access to the “Documents and Settings” folder is denied. This was the problem I ran into. I soon discovered that, in Windows 7, the startup folder was moved to the following locations:

Windows 7 User Profile
  C:\Users\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Windows 7 All Users Profile
 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

Startup scripts are handled the same way in Windows 7 as they were in Windows XP. The difference is that the location of the startup folder has changed.

Reboot Remote Computers

Windows Scripting Host can be used for many things. One frequently used feature is rebooting remote computers. The code below shows how to do that. Simply copy the code and save it as reboot_remote_pc.vbs. Please note that you must have administrator rights on the remote computer in order for this to work

WS = InputBox(“Enter computer name”)
  strComputer = WS

Set objWMIService = GetObject(“winmgmts:” _
  & “{impersonationLevel=impersonate,(Shutdown)}!” _
  & strComputer & “rootcimv2″)

Set colOperatingSystems = objWMIService.ExecQuery _
  (“Select * from Win32_OperatingSystem”)

For Each objOperatingSystem in colOperatingSystems
  ObjOperatingSystem.Reboot()
  Next