I'm trying to get the following script to work, posted questions at the site but not sure if he is viewing the blog anymore.
http://gallery.technet.microsoft.com/scriptcenter/10ca8b47-b0ec-4910-bdd7-52ce2d4bca41#conten
Couple of things is not working with Powershell reporting of DFSR, (works in batch file)
1) The DFSAdmin.exe reports "/Rgname:Domain is not a valid subobject" as I am trying to report on "Domain System Volume". It doesn't like the " and doesn't like spaces!
DfsrAdmin.exe Health New /RgName:`"Domain System Volume`" /RefMemName:$ReferralDC /RepName:$ReportFilePath /FsCount:true
Tried to use variable name instead but same result
$Rgname = "`"Domain System Volume`""
DfsrAdmin.exe Health New /RgName:$Rgname /RefMemName:$ReferralDC /RepName:$ReportFilePath /FsCount:true
2) parsing of report file name doesn't work either, I get "Send-MailMessage : Thew device is not ready.
If I do echo ($ReportFilePath+".html"), the result is correct as I replace the variable with result of the echo and it works!
$ReportFilePath = "d:\Reporting\Reports\Health-report-"+(Get-Date -UFormat %Y-%m-%d)
Send-MailMessage -From $EmailFrom -To $EmailTo -SmtpServer $SmtpServer -Subject $EmailSub -Body "The DFS-R Health Report is attched to this e-mail" -Attachments($ReportFilePath+".html")
The is all on Windows 2008 R2