These instructions are for a PowerShell Module that is used to manage Actifio Appliances
Ensure that Windows PowerShell 3.0 to 5.1 or above is installed on the target workstation. For Windows 7 SP1 and Windows 2008 R2, PowerShell 3.0 should already be installed. We also need .NET 4.0 installed on the OS. To find out the PowerShell version, start PowerShell and then enter the version command as shown:
powershell
$host.version
If you are downlevel, installing the Windows Management Framework 3.0 (https://www.microsoft.com/en-us/download/details.aspx?id=34595) will upgrade your PowerShell software to version 3.0. You should consider upgrading to 5.1 (https://www.microsoft.com/en-us/download/details.aspx?id=54616)
To find out the current version of .NET Framework, enter the following in PowerShell:
$PSVersionTable.CLRVersion
Issues have been seen running PowerShell (as opposed to Windows PowerShell) version 6.0.
At this time we support Windows PowerShell 3.0 to 5.1
To get a list of available modules to the current PowerShell:
Get-module -listavailable
Find out where we should place the Windows ActPowerCLI PowerShell modules in the environment by querying the PSModulePath environment variable:
Get-ChildItem Env:\PSModulePath | format-list
- Download the actpowercli zip file but don't unzip it
- Right select the downloaded zip file and choose properties
- At the bottom of the properties window select the Unblock button next to the message: This file came from another computer and might be blocked to help protect this computer
- Unzip the ActPOWERCLI-7.0.0.6.zip software and copy the ActPowerCLI folder inside it to a relevant directory. For example:
c:\windows\system32\windowspowershell\v1.0\modules
Note! If PowerShell is installed as a 32 bit application, then use the path in this folder: C:\program files (x86)
Import the module into the PowerShell session by running:
Import-module ActPowerCLI
If you get any errors at this point, please review this FAQ document for possible solutions: https://github.com/Actifio/powershell/blob/master/FAQ.md
(Get-Module ActPowerCLI).Version
To automate steps 3-6 listed above, please refer to https://github.com/Actifio/powershell/tree/master/setup-actpowercli
List the available commands in the ActPowerCLI module:
Get-Command -module ActPowerCLI
Find out the syntax and how you can use a specific command. For instance:
Get-Help Connect-Act
If you need some examples on the command:
Get-Help Connect-Act -examples
Following are three different methods of storing a credential in a file:
a) Create an encrypted password file using the PowerShell Get-Credential cmdlet:
(Get-Credential).Password | ConvertFrom-SecureString | Out-File "C:\temp\password.key"
b) Create an encrypted password file using clear text:
"password" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "C:\temp\password.key"
c) Create an encrypted password file using the ActPowerCLI Save-ActPassword cmdlet:
Save-ActPassword -filename "C:\temp\password.key"
Currently if a key file is created by a specific user, it cannot be used by a different user. You will see an error like this:
Key not valid for use in specified state.
This will cause issues when running saved scripts when two differerent users want to run the same script with the same keyfile. To work around this issue, please have each user create a keyfile for their own use. Then when running a shared script, each user should execute the script specifying their own keyfile. This can be done by using a parameter file for each script.
To login to an Actifio appliance (10.61.5.114) as admin and enter password interactvely:
Connect-Act 10.61.5.114 admin -ignorecerts
Or login to the Actifio cluster using the password file created in the previous step:
Connect-Act 10.61.5.114 -actuser admin -passwordfile "c:\temp\password.key" -ignorecerts
You will need to store the certificate during first login if you don't use -ignorecerts
Note you can use -quiet to supress messages. This is handy when scripting.
To list all the Actifio clusters using the udsinfo command:
udsinfo lscluster
To list only the operative IP address:
(udsinfo lscluster).operativeip
To grab the operative IP address for a specific Appliance (called appliance1 in this example):
(udsinfo lscluster -filtervalue name=appliance1).operativeip
To list all the advanced options related to SQL server:
udsinfo lsappclass -name SQLServer
To list all the advanced options related to SQL server and display the results in a graphical popup window:
udsinfo lsappclass -name SQLServer | out-gridview
To list all the fields for all the SQL server databases:
udsinfo lsapplication | where-object {$_.appclass -eq "SQLServer"}
To list selected fields for all the SQL server databases:
udsinfo lsapplication | where-object {$_.appclass -eq "SQLServer"} | select appname, id, hostid
To list all the snapshot jobs for appid 18405:
udsinfo lsbackup -filtervalue "jobclass=snapshot&appid=18405"
To list the above in a table format
udsinfo lsbackup -filtervalue "jobclass=snapshot&appid=18405" | format-table
If you need help with a command, use the -? option:
Get-LastSnap -?
To find out the latest snapshot image for appid 18405:
Get-LastSnap -app 18405 -jobclass snapshot
To get a list of available SARG reports, run either:
reportlist
get-sargreport reportlist
To list all available storage pools on the Actifio appliance, run the reportpools command:
reportpools
Run the SARG reportimages command:
get-sargreport reportimages -a 0 | select jobclass, hostname, appname | format-table
To export to CSV we use the PowerShell export-csv option and then specify the path. In this example you can see the path and filename that was used.
reportsnaps | export-csv -path c:\Users\av\Documents\reportsnaps.csv
To learn the latest snapshot date for each application we could do this:
reportrpo | select apptype, hostname, appname, snapshotdate
To learn the latest snapshot date for each VM we could do this:
reportrpo | where {$_.Apptype -eq "VMBackup"} | select appname, snapshotdate
udsinfo lshost provides us with high level information on a host. To find out the detail information on each host:
udsinfo lshost | select id | foreach-object { udsinfo lshost $_.id } | select svcname, hostname, id, iscsi_name, ipaddress
To list out all the workflow configurations on an appliance, use a combination of reportworkflows and udsinfo lsworkflow:
reportworkflows | select id | foreach-object {udsinfo lsworkflow $_.id}
A common requirement is that you may want to get the latest image name for an application, but the command returns white space and/or multiple lines. In this example the output not only has multiple image names, but white space. This could result in errors when trying to use this image name in other commands like udstask mountimage
PS C:\Users\av> $imagename = udsinfo lsbackup -filtervalue "backupdate since 124 hours&appname=SQL-Masking-Prod&jobclass=snapshot" | where {$_.componenttype -eq "0"} | select backupname | ft -HideTableHeaders
PS C:\Users\av> $imagename
Image_4393067
Image_4410647
Image_4426735
PS C:\Users\av>
If we use a slightly different syntax, we can guarantee both no white space and only one image name:
PS C:\Users\av> $imagename = $(udsinfo lsbackup -filtervalue "backupdate since 124 hours&appname=SQL-Masking-Prod&jobclass=snapshot" | where {$_.componenttype -eq "0"} | select -last 1 ).backupname
PS C:\Users\av> $imagename
Image_4426735
PS C:\Users\av>
Once you are finished, make sure to disconnect (logout). If you are running many scripts in quick succession, each script should connect and then disconnect, otherwise each session will be left open to time-out on its own.
Disconnect-Act