Home > Guides > Windows User Guide > Windows Tutorials > Installing Software Using a PowerShell RightScript

Copyright (c) 2006-2014 MindTouch Inc.

This file and accompanying files are licensed under the MindTouch Master Subscription Agreement (MSA).

At any time, you shall not, directly or indirectly: (i) sublicense, resell, rent, lease, distribute, market, commercialize or otherwise transfer rights or usage to: (a) the Software, (b) any modified version or derivative work of the Software created by you or for you, or (c) MindTouch Open Source (which includes all non-supported versions of MindTouch-developed software), for any purpose including timesharing or service bureau purposes; (ii) remove or alter any copyright, trademark or proprietary notice in the Software; (iii) transfer, use or export the Software in violation of any applicable laws or regulations of any government or governmental agency; (iv) use or run on any of your hardware, or have deployed for use, any production version of MindTouch Open Source; (v) use any of the Support Services, Error corrections, Updates or Upgrades, for the MindTouch Open Source software or for any Server for which Support Services are not then purchased as provided hereunder; or (vi) reverse engineer, decompile or modify any encrypted or encoded portion of the Software.

A complete copy of the MSA is available at http://www.mindtouch.com/msa

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.*browser.shell.checkDefaultBrowser.*",'pref("browser.shell.checkDefaultBrowser", false);' | set-content $firefox_js_path

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

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

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. www.rightscale.com)

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.



Glossary | 用語용어 Site Map | Site Help Community Corporate Site Get Support Dashboard Login
Doc Feedback Product Feedback Resources MultiCloud Marketplace Forums

Dashboard Status

© 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.