Deleting expired SQL server database backup file on data domain using PowerShell I am backing up the database on data domain however I'll have to delete an expired backup using following command. It's an emc databoost agent app for Microsoft sql server.

I am trying to convert the command into powershell so I can run the command to delete expired backups from multiple clients in a loop. That way I can avoid running the command on each individual client.

I created following script and $clientname is hardcoded, but I would like to pass multiple server names as $clientname in loop.

$FileExe = "C:\..\bin\ddbmexptool.exe"
$dbtype = "mssql"
$dduser = "DDBOOST_USER=dduser"
$ddhostpath = "DEVICE_PATH=DDHOSTMSSQL"
$devicehostname = "DEVICE_HOST=ddhost.domain.com"
$clientname = "CLIENT=server1.domain.com"

&amp; $FileExe -n $dbtype -a $dduser -a $ddhostpath -a $ddhostpath -a $devicehostname -a $clientname -b "6 weeks ago" -e "2 weeks ago"
Something like this:

$FileExe = "C:\..\bin\ddbmexptool.exe"
$dbtype = "mssql"
$dduser = "DDBOOST_USER=dduser"
$ddhostpath = "DEVICE_PATH=DDHOSTMSSQL"
$devicehostname = "DEVICE_HOST=ddhost.domain.com"
$servers = "server1","server2","server3"

foreach ($server in $servers)
{
  $clientname = "CLIENT=$server.domain.com"
  &amp; $FileExe -n $dbtype -a $dduser -a $ddhostpath -a $ddhostpath -a $devicehostname -a $clientname -b "6 weeks ago" -e "2 weeks ago"   
}