Hello,
I am trying to implement a monitoring solution for DFSR by having a script generate a health report and send it to me. I have one replication group with 2 members and 2 replicated folders.
The script looks like this:
# Write DFS Health Report Write-DfsrHealthReport -GroupName "RG1" -ReferenceComputerName "SRV1" -MemberComputerName "SRV1", "SRV2" -Path "D:\Logs" -CountFiles # Get the 2 newest files -- these were just generated by Write-DFSRHealthReport $new_report = Get-ChildItem "D:\Logs | Sort-Object -Property LastWriteTime -Descending | foreach {$_.fullname} | Select-Object -First 2 # Send email with attachments $mail_parms = @{'To' = "me"; 'SmtpServer' = ""; 'Subject' = "DFSR Health Report for $(Get-Date)"; 'From' = "SRV1"; 'Attachments' = $new_report } Send-MailMessage @mail_parms
Now here's the fun part:
1) When I run a health report using the GUI, I get a nice, clean report with no errors.
2) When I run my script from a non-elevated ISE, I get the following errors:
- Server 1 shows DFS Replication problems due to temporary attributes
- Server 2 shows as unavailable for reporting because, according to that, I am not an administrator
3) When I run the script form an elevated ISE, both servers show errors about replication problems related to temporary attributes.
I can tell you that:
- The account I am using has administrator rights on both servers
- I have checked that the account has proper permissions in WMI
- When I check for the temporary attribute using Get-Childitem cmdlet (from an elevated PS) nothing shows up.
- I have restarted dfsr service on both servers, no change
So my questions:
1) Why am I getting the WMI error of not being an administrator when I AM an administrator? And why am I getting them only when generating a report using the script and not when I am generating it using the GUI?
2) Why am I getting errors about temporary attributes when I have removed them?
Kind regards,
Wojciech