none
Getting the status of protection group in DPM RRS feed

  • Question

  • Hello,

    I am trying to access DPM from remote server and trying to store the 'name of protection member' and the 'last recovery point' into xml file. I have  xml file declared in the script block. My question is that how can I make my program save the xml file on the server where I am running the script from?

                             

    $sb={

    #$Info = @()
    $pgList = Get-ProtectionGroup -DPMServerName dpm.grasslands.ab.ca 
    if ($pgList -ne $null) 
    {
    #Create the XML file
    [xml]$Doc = New-Object System.Xml.XmlDocument  
    #$dec = $Doc.CreateXmlDeclaration("1.0","UTF-8",$null)
    #$doc.AppendChild($dec)
    $root = $doc.CreateNode("element","prtg",$null)

    foreach ($pg in $pgList) 
        {

            $dsList = Get-DPMDatasource -ProtectionGroup $pg 
            foreach ($ds in $dsList) 
            {

            #$currentReplicaUsedSpaceSizeInGb = [System.Math]::Round(($ds.ReplicaUsedSpace * 1.0) / (1024.0 * 1024.0 * 1024.0), 2);
            $currentLastrecoveryTime = $ds.LatestRecoveryPointTime
            $ServerInfo=$ds.Name+" "+$ds.ProductionServerName
             $c = $doc.CreateNode("element","result",$null)
             $e = $doc.CreateElement("Channel")
             $e.InnerText = $ServerInfo
             $c.AppendChild($e)
             $Val = $doc.CreateElement("Value")
             $now = Get-Date
             $Val.InnerText = $currentLastrecoveryTime
             $c.AppendChild($Val)
             $root.AppendChild($c)

            }

            $doc.AppendChild($root)
            $doc.save("C:\custom.xml")
        } # end foreach $pg

    } # end If $pglist

    }
    Invoke-Command –ComputerName dpm.grasslands.ab.ca –ScriptBlock $sb

    Can anyone help please? Thanks.

    Thursday, May 31, 2018 3:53 PM

Answers