I have created the task sequence for the powershell script. It should run after an hour and seems like task never ends. When I manually run the script, it finishes within 2 minutes. Below is my powershell script:
$sb={
$pgList = Get-ProtectionGroup -DPMServerName xxx
if ($pgList -ne $null)
{
[xml]$Doc = New-Object System.Xml.XmlDocument
$root = $doc.CreateNode("element","prtg",$null)
foreach ($pg in $pgList)
{
$dsList = Get-DPMDatasource -ProtectionGroup $pg
foreach ($ds in $dsList)
{
$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")
$Val.InnerText = $currentLastrecoveryTime
$c.AppendChild($Val)
$root.AppendChild($c)
}
$doc.AppendChild($root)
$doc.save("C:\custom.xml")
} }
Invoke-Command –ComputerName dpm.grasslands.ab.ca –ScriptBlock $sb
Copy-Item -path '\\xxx\C$\custom.xml' -destination '\\yyy\C$\DPMXMLFile'
Attached is the XML file for task sequence. TaskSequenceXML Can anyone help please? Thank you.