Affected Builds
AppAssure 5.3.x
Description
There are situations when adding agents via the bulk protect in which the GUI fails. For instance, after moving the repository to a new core, attempting to bulk protect the agents on that core does not work, as it only protects the first agent in the list. All others will fail.
Warning: All scripts provided in this article are meant to be used as examples and are not supported by AppAssure. For more information on Dell | AppAssure scripting support, click here.
Resolution
A PowerShell script has been prepared to solve this issue. The script needs to be run on the core to protect the servers and has a series of limitations caused mainly by the AppAssure Powershell Commandlet. However, the script may prove to be very useful in the case of large deployments. Essentially, the script pauses all transfers (please note that this does not apply to the newly added agents which will be backed up as soon as a slot is available in the transfer queue), asks for the path of the file holding the agent names (need to be entered one per line) and provides a default path. Furthermore, a repository name needs to be entered. If no repository name is provided, the script will detect the repositories belonging to the deployment core and ask the user to choose the desired one for each server to be added to protection. In order to protect privacy, the credentials necessary adding servers to protection are processed via a popup window. This feature was implemented at the request of customer working with support engineers to avoid sharing the passwords in clear text. Once the credentials are entered the script contacts each agent via a WMI call and collects the list of available logical disks. Please note that the System Reserved Partitions are not detected and need to be added manually, which is the first limitation of the script. The second and more important limitation is that there is no way to pause initial transfers or set a protection schedule at the time of adding the server to protection.
Write-host “`r`n`r`nAdd Agents To Protection” -F “Green”
Write-Host “————————”
Write-Host “CTRL-C to EXIT`r`n”
Write-host “Pausing all snapshots`please do not forget to re-enable them when all the operations are finished” -f “Yellow”
suspend-snapshot -all
#default path of the file with the servers’ names. Change with your preferred one.
$defaultFile = “c:\temp\agents.txt”
#get an alternate path interractively
Do {
$Agents = Read-Host “`r`nPath to the server list; default [$($defaultFile)]”
if($Agents -eq “”){$Agents=$defaultFile}
}
while (!(Test-Path $Agents -PathType Leaf))
$protectedagents = get-content $Agents
$repo = Read-Host “`r`nEnter Repository Name no double quotes if multiple words, please`r`nIf not sure, hit Enter and you will be
asked for each agent`r`n”
Write-Host “We assume that all agents on the list can be added to protection using the same`r`nusername and password`r`n”
$crd = Get-credential
$username=$crd.username
$password=$crd.getnetworkcredential().password
foreach ($agent in $protectedagents)
{
$agent
Write-host “Attempting Protection” -F “Yellow”
$drives = get-wmiobject Win32_logicaldisk -computername $agent -credential $cred | where {$_.drivetype -eq 3} | select-object -
expandproperty deviceid
start-protect -repository $repo -agentname $agent -agentpassword $password -agentusername $username -volumes $drives
start-sleep 2
}