AutoSPInstaller keeps installing SharePoint binary after restart

AutoSPInstaller ( is a neat tool for unattended SharePoint install and configuration. I ran into an issue where AutoSPInstaller just seems to get stuck in a loop. After SP is installed, it prompted me to restart the server and re-run the script. I did this, but when I re-run the script it installs SP again and the loop goes on.

This problem was caused by the fact that I was running the AutoSPInstaller script under a 32 bits process.

In the AutoSPInstaller script, there is a line that looks like this:

If  (Test-Path “$env:CommonProgramFiles\Microsoft Shared\Web Server Extensions\14\BIN\stsadm.exe”) #Crude way of checking if SP2010 is already installed

This line checks if the file stsadm.exe exists to determine if SP has been installed. If the file is not found, the script goes ahead and installs SP.

The problem is in the $env:CommonProgramFiles part, which is different under 32 vs 64 bits. This is why in my case the script keeps trying to install SP each time it is re-ran.

So how did I manage to run the script under a 32 bits process? Because I launched the script from an HTA :), and by default HTA launches under a 32 bits process. As a quick fix for this, I created a batch file that launches the 64 bits version of the HTA instead – which is at C:\Windows\System32\mshta.exe.


About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in AutoSPInstaller, SharePoint 2010. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s