1

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"

& $FileExe -n $dbtype -a $dduser -a $ddhostpath -a $ddhostpath -a $devicehostname -a $clientname -b "6 weeks ago" -e "2 weeks ago"

1 Answer 1

0

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"
  & $FileExe -n $dbtype -a $dduser -a $ddhostpath -a $ddhostpath -a $devicehostname -a $clientname -b "6 weeks ago" -e "2 weeks ago"   
}
1
  • Thanks. It worked although it does return file sets before deleting actual file, it also throws following error :- ddbmexptool.exe : Setting default operation display information for savesets by savetime range. At D:\...\ddboostscript2.ps1:12 char:3 + & $FileExe -n $dbtype -a $dduser -a $ddhostpath -a $ddhostpath -a $ ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (Setting default...savetime range.:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError` Commented May 22, 2020 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.