Thursday, October 6, 2016

PowerShell: Download and Install Java 8 JRE

This script I wrote for our automation system that will:
  1. Download the latest Java 8 JRE from
  2. Save in a local directory C:\Install
  3. Create a Install Options File
  4. Run the installer silently with the necessary Installer Options
The Installer Options file determines what configuration is used the install of Java.

For example, in the script I have configured. This will perform a silent install, auto updates enabled, no reboot after the installation, Sponsors/ads install disabled and will uninstall any older existing installations of Java JRE.

  • AUTO_UPDATE=Enable
  • REBOOT=Disable
  • SPONSORS=Disable
You can find these and other options to use from the Java website:

This has been tested to work on PowerShell v2 and higher.

                Deploy Java JRE Software
                  Date: 21-Sept-2016
               Created by: Daniel Burrowes

Downloads the Java installer and installs silently


# -Verbose and -Debug

    param(    )

# --------------------------------------------------------------------------

Write-Verbose "Setting Global Variables..."
$InstallDir = "c:\Install\Java"
$Source = ""
$Destination = "$InstallDir\java.exe"
$Options = "$InstallDir\java_options.txt"

#Create install directory
Write-Verbose "Creating Install Directory"
New-Item -Path $InstallDir -ItemType directory -Force

Write-Verbose "Downloading Software..."
$start_time = Get-Date
(New-Object System.Net.WebClient).DownloadFile($Source, $Destination)
Write-Verbose "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)" 

Write-Verbose "Creating Installer Options File..."
$text = 'INSTALL_SILENT=Enable

# Create file
$text | Set-Content $Options

#Running the installer
Write-Verbose "Executing Java Install.."
Start-Process -FilePath $Destination -ArgumentList "INSTALLCFG=$Options /s /L $InstallDir\jre-install.log" -Wait -Verbose -PassThru

Monday, April 25, 2016

PowerShell: BATCH Script to Allow PowerShell Scripts to Execute

For some SysAdmins, they will use one or more tools to deploy software to a range of computers on their network. For me, it our monitoring tool that allows are to remote execute scripts to do some sort of task.

Writing in PowerShell is amazing and is Microsoft's best yet command line tool. However by default for security purposes, script execuition is blocked for untrusted or unsigned scripts.

I won't go into Signing scripts just now but using the following command will allow you to run PowerShell Scripts

Set-ExecutionPolicy -RemoteSigned

This line still provides a level of protection while still allwoing you to execute custom scripts. Other switches include -bypass and -unrestricted.

So how can we get a large number of these set?

There are a number of ways:
  1. Group Policy
  2. Batch Script
The reason for me writing this BATCH Script is that it allows me to deploy and run on a computer regardless of the Domain it is joined to.

Copy and paste this code into a text file called SetExecutionPolicy.bat and then Save.

This script also creates entries into the Windows Event Viewer to tell you if and when the command has been executed, or if it failed to run.

@echo off

REM -------------------------------------------------------------
REM       Set-ExecutionPolicy RemoteSigned for Powershell
REM          Date: 10-Spet-2015
REM        Author: Daniel Burrowes
REM -------------------------------------------------------------

Echo Setting PowerShell Execution Policy for RemoteSigned

PowerShell.exe Set-ExecutionPolicy RemoteSigned


EVENTCREATE /T INFORMATION /L APPLICATION /ID 100 /D "PowerShell Execution Policy has been set to RemoteSigned"


EVENTCREATE /T ERROR /L APPLICATION /ID 100 /D "PowerShell ExecutionPolicy batch script failed to run." 


Echo Done!


PowerShell: Download and Install Citrix Receiver

I have been doing quite a bit of work lately on PowerShell scripting for work and this is a common one we deploy to our clients that use Citrix.

This script does the following:
  1. Creates the folder C:\Install\CitrixReceiver
  2. Downloads the latest Citrix Receiver software from the Citrix website
  3. Installs the downloaded Receiver silently
The link for the Citrix Receiver is:

Works with PowerShell v2 and higher.
A lot of my scripts are built to work at this level as it means that I can deploy my scripts to older machines without having to first upgrade PowerShell.

Copy and paste the code into a text file called InstallCitrixReceiver.ps1.

# --------------------------------------------------------------------------
#                Citrix Receiver Install Script
#                   Date: 14-Mar-2016
#               Created by: Daniel Burrowes
# --------------------------------------------------------------------------

# -Verbose and -Debug


# --------------------------------------------------------------------------
#  Change Log
#  14-Mar-2016
# -Added /IncludeSSON to argument list
# --------------------------------------------------------------------------

#Create install directory
Write-Verbose "Creating Install Directory"
$InstallDir = "C:\Install\CitrixReceiver"
New-Item -Path $InstallDir -ItemType directory -Force

Function Download-Citrx {

 $Source = ""
 $destination = "C:\Install\CitrixReceiver\CitrixReceiver.exe"

    Write-Verbose "Downloading Software..."
    (New-Object System.Net.WebClient).DownloadFile($Source, $Destination)
    Write-Verbose "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)" 


Write-Verbose "Downloading Latest Citrix Receiver"

Write-Verbose "Running silent install of Citrix Receiver"
Start-Process -FilePath "C:\Install\CitrixReceiver\CitrixReceiver.exe" -ArgumentList "/silent /IncludeSSON" -Wait -Verbose -PassThru

Executing Powershell scripts may require you to allow scripts to run.:
#Set-Execution Policy -RemoteSigned

Tuesday, May 26, 2015

VMware ESXi E1000 vs VMXNET3 Network Adapters

I found this really helpful article from Rickard Nobel who has done a set of testing showing the performance improves when using VMXNET3 network adapters over the emulated E1000 cards.

Check it out and leave a comment.

Monday, May 25, 2015

Windows Update Servers List

Here is a list of the server addresses required for accessing Microsoft Update servers.
This may required for firewall or proxy policies.
  • http://* 
  • https://* 
  • http://* 
  • https://* 
  • http://* 
  • http://* 

See this article for further information

Windows Activation Servers

In some case you might need a list of the servers required for Microsoft Windows activation to apply to a firewall or proxy policy.

This is the list as defined by Microsoft:

See this article for further information:

Monday, April 20, 2015

EATON IPM Appliance: Update IP address

The EATON Intelligent Power Manager is a software package that help monitor and manager UPS connected to your server infrustracture and can be installed in different ways. For virtual environments, the easiest way is to deploy the pre-configured Virtual Appliance for VMware ESXi.

However what I discovered is there is no easy way to reconfigure the IP addresses just from the management console. As the appliance is based on Centos Linux, you can use basic Linux commands to change the IP address.

For this, you will need either direct console access or SSH.
As you will be changing the IP address and a disconnection will be required, I advise connecting via the direct console.

  1. Log on to the Virtual Appliance as root
    (Default username is 'root'; default password is eaton)
  2. Use vi to modify the ifcfg-eth0 file

    #vi /etc/sysconfig/network-scripts/ifcfg-eth0

    Update with the following lines:

    Then, save and close (:wq)
  3. Use vi to modify the sysconfig/network file

    #vi /etc/sysconfig/network

    Update with the following lines:

    Then, save and close (:wq)
  4. Restart the network service to have settings take affect

    #service network restart

Office 365 ScanPST to fix corrupted Outlook files

In Office 365, which uses the Click-to-Run technology, Office program files are now in a new location.

When you experience issues with Outlook, often you would use the ScanPST.exe tool to repair PST and OST files with Outlook.

This tool can now be found in the following location:

C:\Program Files\Microsoft Office 15\root\office15\ScanPST.exe

Microsoft has published a Knowledge Base article list the locations of the ScanPST utility depending on your installation of Office 365. Whether you're using 32 or 64 bit versions.

This should apply for both 32-bit and 64-bit installations of Office 365.

Friday, February 27, 2015

Unable to activate Office 2013

During the setup of some PCs recently I found the error that Office 2013 would not activate. While I did some Google searches and a lot of forums often said the solution was to reinstall the software, which is a lot of effort, especially if you have the error on multiple computers.

This is the error I received:

For this particular instance, I found that I had to open an Office app (whether it was Word or Excel etc.) as Administrator. Meaning, right-clicking the icon and selecting Run as Administrator.

Once it was running as Administrator, I was able to get it activiated.

Not sure what was different able that installation but that's what I had to do to get it activated.

Outlook 2003 showing incorrect email time on Citrix XenApp 5.0


Citrix XenApp 5.0
Windows Server 2008 R1 (64-bit)
Microsoft Office 2003 Professional (32-bit)


When using Outlook 2003 via Citrix session, time zones in Outlook would not match the user session time via Citrix. Email would show the wrong received timestamps.

However if you log on to the same server via Microsoft Remote Desktop (RDP) instead of via Citrix (ICA) the timestamps would be correct.

When going to Options > Calendar Options > Time Zones... Outlook would default to (GMT) Coordinated Universal Time.


We found that registry for AppInit_DLLs registry entries for Citrix was missing. Specifically, the DLL references that provided the necessary hooks for Citrix to provide the time zone redirection of the client session. Since the office application was 32-bit, this meant that the reference for 32-bit applications for these required hooks weren't being applied despite what the Windows Server GPO was instructing or redirecting.
This is the correct setting.

32-bit Application Reference

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Windows

AppInit_DLLs = c:\progra~2\citrix\system32\mfaphook.dll,mfaphook.dll

64-bit Application Reference 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows
AppInit_DLLs = c:\progra~2\citrix\system32\mfaphook64.dll,mfaphook64.dll