- Download Plink and PuTTYgen from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
- Use PuTTYgen to create your key pair. Save both the public and private key
- Log onto the Avamar utility node and add the contents of the private key to the authorized_keys file in the ~user/.ssh directory.
- Save the private key and Plink on the windows computer that you will be running the powershell scripts on. Protect your private key. Anyone that gains access to the file will have access to the utility node.
- Create your PowerShell script. In this example you need to set the variables for where the key and Plink reside, the full path to the private key, and the command you want to execute.
- $plinkfolder="C:\Program Files (x86)\PuTTY"
$privateKey="C:\Program Files (x86)\PuTTY\avamar_vmware_script_priv.ppk"
$avamarunode="user@ahavmrun.ent.lolcentral.com"
$Command="/usr/bin/java -jar /usr/local/avamar/bin/proxycp.jar --selectalldatastore"
cd $plinkfolder
./plink.exe $avamarunode -ssh -i $privatekey $Command
Over the last few years I've learned a lot from random blogs and forum hits. I figured it's time I give a little of it back. Hopefully someone finds something useful.
Tuesday, April 21, 2015
Using PowerShell to Automate Avamar Tasks with SSH
I wanted to give our operations group the ability to execute various scripts or commands on the Avamar utility node without giving them direct SSH access. This can be accomplished using key based authentication, Plink, and powershell.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment