RSS

SCCM Package – Putty

19 Mar

This is a short blog post about installing a program silently that uses the command “xcopy”. Since Putty is a very basic program it does not install, it simply runs. The end goal of this post will be to install Putty on a target machine. This will allow us to automate the install on new lab machines that we receive.

Overview

  1. Figure out the silent install mechanism.
  2. Create and test a silent install script.

Notes & Sites of reference:

Manual installation

First, I will install the Putty program manually to to familiarize myself with the application.

  1. If you are installing on a Virtual Machine, it is a great idea to make a snapshot before you continue.This will enable us to quickly try the silent install multiple times if needed, without having to uninstall the program each time. Sometimes uninstallers don’t remove everything. This can affect the silent install package and make you think it is working when really, the silent install package created is dependent on something that the previous installer left behind. Better to start with a clean image each test.
  2. Get the installer from the Putty downloads page.
  3. Locate and double click on your “putty.exe”. A screen will pop up and click “Run”.
  4. Putty should just open.

Creating a Batch file

  1. Create a temporary directory at “C:\workingtemp\Putty” and place the “putty.exe” in this directory.
  2. Create a Batch file and name it “Install-Putty.cmd” and add it to the folder you just created..
  3. Next lets build the batch file.
    xcopy /y putty.exe %systemroot%
  4. This will simply copy the “putty.exe” to the %systemroot% folder. Usually this is C:\Windows.

Testing the Batch File

  1. Open a command prompt as “Administrator”.
  2. Change directories to “C:\workingtemp\putty” with the following command.
    cd C:\workingtemp\Putty
  3. Now run the batch file with the following command.
    Install-Putty.cmd
  4. If the installation was successful, then “putty.exe” will be in your “C:\Windows” folder.
  5. At this point you are done.
Advertisements
 
3 Comments

Posted by on March 19, 2012 in Uncategorized

 

3 responses to “SCCM Package – Putty

  1. Mike Crowley

    September 7, 2012 at 9:31 pm

    We also had to “deploy” putty. this copies the file and creates a start menu shortcut (powershell):

    #########save this as puttyinstaller.ps1############
    #copy from package directory
    $Source = get-childitem
    $Destination = (Get-ChildItem ‘Env:\ProgramFiles(x86)’).value + “\Putty”
    New-Item $Destination -Type Directory
    Copy-Item $Source -Destination $Destination -Recurse

    #create start menu shortcut
    $WshShell = New-Object -comObject WScript.Shell
    $Shortcut = $WshShell.CreateShortcut(“C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Putty.lnk”)
    $Shortcut.TargetPath = “C:\Program Files (x86)\Putty\putty.exe”
    $Shortcut.Save()

    #From SCCM:
    #PowerShell.exe -executionpolicy bypass -File PuttyInstaller.ps1

     
    • win1337ist

      September 14, 2012 at 5:23 pm

      Great stuff here, putty is a great program to learn how to package and modify.

       
  2. Davert

    February 17, 2014 at 6:26 pm

    Hello,

    Many thanks for the script Mike, hope you don’t mind, i’ve taken your Powershell script, tweaked a little and created a removal script too:

    We placed the PS scripts in the same directory as the exe in our Package Store so don’t want the ps script copying down, this only copies the .exe:

    #########save this as PutyInstaller.ps1############
    #copy from package directory
    $Source = get-childitem -path *.exe
    $Destination = (Get-ChildItem ‘Env:\ProgramFiles(x86)’).value + “\Putty”
    New-Item $Destination -Type Directory
    Copy-Item $Source -Destination $Destination -Recurse

    #create start menu shortcut
    $WshShell = New-Object -comObject WScript.Shell
    $Shortcut = $WshShell.CreateShortcut(“C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Putty.lnk”)
    $Shortcut.TargetPath = “C:\Program Files (x86)\Putty\putty.exe”
    $Shortcut.Save()

    #From SCCM:
    #PowerShell.exe -executionpolicy bypass -File PuttyInstaller.ps1

    Removal script:

    #########save this as RemovePutty.ps1############
    #remove package directory
    $Destination = (Get-ChildItem ‘Env:\ProgramFiles(x86)’).value + “\Putty”
    Remove-Item -path $Destination -Recurse

    #delete start menu shortcut
    Remove-item -path “C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Putty.lnk”

    #From SCCM:
    #PowerShell.exe -executionpolicy bypass -File RemovePutty.ps1

    —————————————————————————————————

    Set the detection method to look for Putty.exe in C:\ProgramFiles(x86)\Putty and then go and have a brew.. 🙂

     

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

 
%d bloggers like this: