Note: Please go to to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > Windows User Guide > Windows Tutorials > Installing Software Using a PowerShell RightScript

Installing Software Using a PowerShell RightScript


The objective of this tutorial is to demonstrate installing different pieces of software on a running Windows Server using a PowerShell Script.

Table of Contents


This tutorial assumes you have a running Windows Server, and access to the software installation files.  If you do not have a Windows server running, you could launch one using the 'Base ServerTemplate for Windows' ServerTemplate from the Marketplace.

Run .NET in the cloud with RightScale: Try it free.


The aim of the tutorial is to use PowerShell to install Firefox.  This will help to draw attention to the individual steps and also the different PowerShell constructs involved. 

Before you begin you may wish to RDP into your running Windows server so you can see the installation activity as you run the scripts.  In particular, if you open Windows Explorer you should see new directories being created under 'C:\Program Files(x86)'.


Create the Firefox Install RightScript

To install the software on the server we will create a RightScript and attach to it the relevant installation files.  When we run the script these installation files will be copied over onto the server.  If you've never created a RightScript before, see Create a New RightScript.  

Scroll down to the bottom of this document and download the Firefox Installer (Firefox_Setup_3.6.8) and the INI file (firefox_quiet_install.ini) locally to your PC.  You will attach these to your RightScript a little later.

To create the RightScript, navigate to Design > RightScripts.  Click New, and enter the name and description for your installation RightScript. Copy the following and paste it into the Script area:

# Windows powershell RightScript to install Firefox browser

#stop and fail script when a command fails

if (${env:programfiles(x86)})
  { $firefox_path = join-path "${env:programfiles(x86)}" "Mozilla Firefox" }
  { $firefox_path = join-path "${env:programfiles}" "Mozilla Firefox" }

if (test-path $firefox_path)
   Write-Output "Firefox already installed. Skipping script"
   exit 0

mv "$env:RS_ATTACH_DIR\Firefox_Setup_3.6.8" "$env:RS_ATTACH_DIR\Firefox_Setup_3.6.8.exe"
cmd /c "$env:RS_ATTACH_DIR\Firefox_Setup_3.6.8.exe" /INI="$env:RS_ATTACH_DIR\firefox_quiet_install.ini"

#Permanently update Windows Path
if (Test-Path $firefox_path) 
  [environment]::SetEnvironmentvariable("Path", $env:path+";"+$firefox_path, "Machine")
} Else {
  Write-Error "Failed to install FireFox. Aborting."
  exit 1

$firefox_js_path = join-path $firefox_path "defaults/pref/firefox.js"

#no warning on quit
(get-content -path $firefox_js_path) -replace "pref.*browser.warnOnQuit.*",'pref("browser.warnOnQuit", false);' | set-content $firefox_js_path

#do not check for default browser
(get-content -path $firefox_js_path) -replace "pref.**",'pref("", false);' | set-content $firefox_js_path

#set blank startup page
(get-content -path $firefox_js_path) -replace "pref.**",'pref("",0);' | set-content $firefox_js_path

#set homepage
(get-content -path "$firefox_path/") -replace "(startup.homepage=).*","`${1}$env:FIREFOX_HOMEPAGE" | set-content "$firefox_path/"

Click Save.

Click the script's Attachments tab, and upload the following files (attached to this document)

Run the script on the server

Navigate to Manage -> Servers -> Active tab, click your running Windows server and select the Scripts tab.  Click 'Any Script' and find your new script under 'Unpublished' and run the script. When prompted, provide a value for the FIREFOX_HOMEPAGE input (e.g.

Wait for the script to complete before going to the next step.  


RDP into the server

To verify the successful installation of Firefox, RDP into the Windows Server.

Note: TCP port 3389 must be open in the server's security group.

Use the RDP server button(Internet Explorer only) or use your preferred RDP client with the public IP of the server.

You should see Firefox as successfully installed under Start > Programs > Mozilla Firefox.




Post Tutorial Steps

Once completed, remember to shut down the server (if no longer required) in order not to incur any unnecessary charges.

You must to post a comment.
Last modified
23:22, 16 May 2013


This page has no custom tags.


This page has no classifications.



© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.