DFSR Health check and report

This e-mail based report is designed to help System Administrators to be able to see at a glance whether there is anything requiring attention in their DFSR environment.

 
 
 
 
 
4 Star
(1)
969 times
Add to favorites
Storage
8/1/2019
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Errors on running script
    3 Posts | Last post May 07, 2019
    • Hi
      This seems to be something that would be very helpful for me.
      However when trying to run the script i get the following errors
      
      Cannot convert value "The replicated folder has a backlog of files. Replicated folder" to type "System.Int32". Error: "Input string was not in a correct format."
      At C:\temp\DFSR-22-March-2019.ps1:71 char:1
      + $int = [int]$BL
      + ~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvalidCastFromStringToInteger
      
      Cannot convert value "No backlog for the replicated folder named "H"" to type "System.Int32". Error: "Input string was not in a correct format."
      At C:\temp\DFSR-22-March-2019.ps1:71 char:1
      + $int = [int]$BL
      + ~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvalidCastFromStringToInteger
      
      Also, is it pssible to just save the report to file instead of sending with email?
    • Hi Stefan,
      
      Can you please open the script in ISE and run it, then once done and assuming you get the same errors, can you tell me the output of $BLcount
      
      Aside from the editable variables, have you made any changes to the script? 
      
      Can you read through your copy of the script to make sure there are no bad characters from copy paste or any accented characters like á, é, í, ó, ú, ü, ñ ... 
    • I am not tha familiar with PS and ISE. I made a breakpoint after the section throwing the error ang hovered over thje BLcount ad it says
      No backlog for the replicated folder named "H"
      just like in the above message. Is this what you asked for?
      
      I have downloaded the ps1-file so no copying. Have read through the script and cant fin any odd characters. And i havent made any changes at all but the editable variables.
  • Your Clean-Up Function does not work as expected.
    2 Posts | Last post April 08, 2019
    • debugging the errors I discovered your Clean-Up Function nukes the variables you require to be set:
      
      Code snippet:
      
      Clean-up
      write-host "Values after cleanup:"
      write-host "From: $smtpFrom"
      write-host "To: $smtpTo"
      write-host "Subject: $Subject"
      write-host "SmtpServer: $smtpServer"
      write-host "SmtpPort: $smtpPort"
      write-host "DFSroot: $DFSroot"
      
      Output:
      
      Values after cleanup:
      From:
      To:
      Subject:
      SmtpServer:
      SmtpPort:
      DFSroot:
      
      
      
    • have you had a moment to test that the script is now working for you?
  • Script has errors
    3 Posts | Last post March 22, 2019
    • Line 18 - clear variable doesn't work.
      
      Do you have to make it
      
      Clear-Variable -Name clear
      
      instead of 
      
      Clear-Variable -Name $clear
      
      ?
    • Hi TZ1231,
      
      I have changed this to a function which is a MUCH better way of cleaning up.
      
      $varlist = ('content,dclist,pingfail,pingerr,dcpingerror,services,service,servicelist,pingxc,svcxc,state,st,ss,sn,end,dcs,ping,udpports,udpportlist,port,udpxc,dc,data,prt,udpobj,aaa,byte,farpc,recd,reply,svr,uport,opn,note,endtcp,tcpportlist,tcpports,tcpxc,tcpport,tcp,nltest,getrep,sep,repline,repserver,reppartner,repcon,replast,pdce,pdc,zones,dnszones,dz,zone,domres,dnsxc,dnszxc,primaryns,dcdiagdata,dcdiagresult,testitem,dcdiagadvertdata,dcdiagadvert,dcdiagadvertresult,adverttestitem,dcdiagfsmodata,dcdiagfsmo,dcdiagfsmo,fsmotestitem')
      $cleanvars = $varlist.Split(",")
      Function Clean-up {
      Get-Variable |
       Where-Object { $cleanvars -notcontains $_.Name } |
       ForEach-Object {
        try { Remove-Variable -Name "$($_.Name)" -Force -Scope "global" -ErrorAction SilentlyContinue -WarningAction SilentlyContinue}
        catch { }
       }
      }
      
      Clean-up
    • Hi marcadams,
      
      Yeah that was because I had the Clear Variables function directly AFTER where the Variables were entered ...