Announcement

Collapse
No announcement yet.

How to setting auto verify check replication between DC and additional and auto

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to setting auto verify check replication between DC and additional and auto

    I need to use power shell can run check status replication between DC with additional and has automate send email to my group IT






    Resource :
    Windows 2008 =DC
    windows 2008= Additional DC
    windows2003= Additional DC e-mail server = smtp port:2525


    I follow step this link http://technodrone.blogspot.com/2010...atus-with.html


    when running script has error please help to advise
    Attached Files

  • #2
    Re: How to setting auto verify check replication between DC and additional and auto

    I cannot get result file check replica
    Attached Files

    Comment


    • #3
      Re: How to setting auto verify check replication between DC and additional and auto

      (Mod: I have moved this thread to Powershell forum)


      Wrong syntax here,
      $workfile = repadmin /showrepl * >csv

      it should be,
      $workfile = repadmin.exe /showrepl * /csv
      or in your case maybe better,
      $workfile = repadmin.exe /showrepl * /errorsonly /csv

      Make sure the powershell version on the machine you running the command from is 2 or above.
      Run this command,
      $PSVersionTable.psversion
      to check the version (listed in first column). If the command fails you have version 1.


      btw, the link to technodrone.blogspot.com/... seems to be broken

      /Rems
      Last edited by Rems; 3rd December 2013, 22:25. Reason: moved this thread to Powershell forum

      This posting is provided "AS IS" with no warranties, and confers no rights.

      __________________

      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts

      Comment


      • #4
        Re: How to setting auto verify check replication between DC and additional and auto

        This Full script


        $from = "Replication Status<[email protected]>"
        $to = "User Group<[email protected]>"
        #Collect the replication info

        #Check the Replication with Repadmin
        $workfile =C:\rep\repadmin.exe /showrepl * /errorsonly >csv

        $results = ConvertFrom-Csv -InputObject $workfile | where {$_.'Number of Failures' -ge 1}
        $strOutFile = "C:\rep\Check-Replication.htm"

        #Here you set the tolerance level for the report
        $results = $workfile | where {$_.'Number of Failures' -gt 1 }

        if ($results -ne $null ) {
        $results = $results | select "Source DC", "Naming Context", "Destination DC" ,"Number of Failures", "Last Failure Time", "Last Success Time", "Last Failure Status" | ConvertTo-Html
        } else {
        $results = "There were no Replication Errors"
        }
        #Send-MailMessage -From $from -To $to -Subject "Daily Forest Replication Status" -SmtpServer "smtp.domain.com" -BodyAsHtml ($results | Out-String)

        $filedate = get-date
        $filedate = $filedate.ToString()

        $results = "" + $filedate + "
        " + $results + "
        "
        $results | Out-File $strOutFile

        Comment


        • #5
          Re: How to setting auto verify check replication between DC and additional and auto

          Originally posted by momaydopod View Post
          Code:
          $from = "Replication Status<[email protected]>"
          $to = "User Group<[email protected]>"
          #Collect the replication info
          
          #Check the Replication with Repadmin
          $workfile =C:\rep\repadmin.exe /showrepl * /errorsonly >csv
          
          $results = ConvertFrom-Csv -InputObject $workfile | where {$_.'Number of Failures' -ge 1}
          $strOutFile = "C:\rep\Check-Replication.htm"
          
          #Here you set the tolerance level for the report
          $results = $workfile | where {$_.'Number of Failures' -gt 1 }
          
          if ($results -ne $null ) {
          $results = $results | select "Source DC", "Naming Context", "Destination DC" ,"Number of Failures", "Last Failure Time", "Last Success Time", "Last Failure Status" | ConvertTo-Html
          } else {
          $results = "There were no Replication Errors"
          }
          #Send-MailMessage -From $from -To $to -Subject "Daily Forest Replication Status" -SmtpServer "smtp.domain.com" -BodyAsHtml ($results | Out-String)
          
          $filedate = get-date
          $filedate = $filedate.ToString()
          
          $results = "" + $filedate + "
          " + $results + "
          "
          $results | Out-File $strOutFile

          Firstly, change >CSV to /CSV

          Also change;
          Code:
          #Here you set the tolerance level for the report
          $results = $workfile | where {$_.'Number of Failures' -gt 1 }
          To
          Code:
          #Here you set the tolerance level for the report
          $results = $results  | where {$_.'Number of Failures' -gt 1 }
          (btw. setting the tolerance level is optional, you can comment-out ( # ) the line if you don't want to use it)



          btw, the link to technodrone.blogspot.com/... seems to be repaired again. However the code we see there is not exactly the code you have posted here, that version does not contain the above typos. And there is no $strOutFile variable in that script. > there is an UPDATE notification below the article though.

          To export the results to a HTM file ($strOutFile), rewrite the last 4 lines to just one: $filedate + $results | Out-File $strOutFile


          /Rems
          Last edited by Rems; 4th December 2013, 14:57.

          This posting is provided "AS IS" with no warranties, and confers no rights.

          __________________

          ** Remember to give credit where credit's due **
          and leave Reputation Points for meaningful posts

          Comment


          • #6
            Re: How to setting auto verify check replication between DC and additional and auto

            This's command error
            Attached Files

            Comment


            • #7
              Re: How to setting auto verify check replication between DC and additional and auto

              We know that already.
              The first thing to do is what I posted twice already -> correct the typo's

              /Rems

              This posting is provided "AS IS" with no warranties, and confers no rights.

              __________________

              ** Remember to give credit where credit's due **
              and leave Reputation Points for meaningful posts

              Comment


              • #8
                Re: How to setting auto verify check replication between DC and additional and auto

                I tyr to run


                PS C:\Users\Administrator> $PSVersionTable.psversion

                Major Minor Build Revision
                ----- ----- ----- --------
                2 0 -1 -1

                Comment


                • #9
                  Re: How to setting auto verify check replication between DC and additional and auto

                  Originally posted by momaydopod View Post
                  I tyr to run
                  Code:
                  PS C:\Users\Administrator> $PSVersionTable.psversion
                  
                  Major Minor Build Revision
                  ----- ----- ----- --------
                  2 0 -1 -1
                  The version of powershell installed on your computer is good.

                  This posting is provided "AS IS" with no warranties, and confers no rights.

                  __________________

                  ** Remember to give credit where credit's due **
                  and leave Reputation Points for meaningful posts

                  Comment

                  Working...
                  X