This code works but it is taking too much memory, how can i replace it by processing the data and doing the recalc afterwards?
try{
$secpasswd = ConvertTo-SecureString "X" -AsPlainText -Force;
$mycreds = New-Object System.Management.Automation.PSCredential ("X", $secpasswd);
Invoke-ProcessASDatabase -Server "X" -DatabaseName "#" -RefreshType "Full" -Credential $mycreds -ErrorAction Stop;
exit 1
}
catch{
exit 0
}