Author Posts

April 18, 2018 at 5:25 pm

So I am using Get-ADReplicationUpToDatenessVectorTable
It returns something something like whats below, just for every DC, even old and non-existing:
LastReplicationSuccess : 12/21/2017 5:29:13 PM
Partition : CN=Schema,CN=Configuration,DC=YOURDCHERE
PartitionGuid : a6229360-894f-4c6c-aa4b-63737372866c
PartnerInvocationId : daf3888f-762b-4ae3-8cc0-0934b00aa0e6
UsnFilter : 24426112

What I want to do is take all that data, then filter out the blocks that show NO partner data. So "Partner: "

Then I want to look for LastReplicationSuccess and compare it to todays data. If its more then 1 day off from today do something.

Problem is I am not sure how to parse the data properly to be able to do this.

Anyone have any ideas?

April 18, 2018 at 6:31 pm

You're looking for Where-Object, I think. You can roll both filter steps into a single query.

Get-ADReplicationUpToDatenessVectorTable |
    Where-Object {
        -not $_.Partner -and
        $_.LastReplicationSuccess -lt (Get-Date).AddDays(-1)
    } | ForEach-Object {
        # Do something with each object that passes the conditions.

As an example. May need some further tweaking. 🙂

April 18, 2018 at 6:48 pm

Thats great. Thank you. That solves the date problem easy.
Let just take it without the date.
I need store all the output of Get-ADReplicationUpToDatenessVectorTable into a variable without the junks with the null partner field.

Any Ideas how I would go about doing that? I keep trying but failing. Hopefully I am wording this correctly.

April 18, 2018 at 6:53 pm

Strip out the date check and remove the ForEach-Object, and store it into a variable.

$var = # everything else 

April 18, 2018 at 7:01 pm

Ok. I am noob.

Obviously not like this because it doesnt work.
$var = Get-ADReplicationUpToDatenessVectorTable |Where-Object { -not $_.Partner }

April 18, 2018 at 7:11 pm

Get-ADReplicationUpToDatenessVectorTable |Where {$_.partner -ne $null}

That will give you all the results where partner has a value

April 18, 2018 at 7:25 pm

Thank you.
I also just figured out part of my problem was I was running: Import-Module ActiveDirectory on a computer without rsat :facepalm:
I switched computers and everything works great now. :derp:

Thank you very much for your help. I learned alot 🙂

April 18, 2018 at 10:34 pm

dar –

You also don't need to install RSAT to use the ADDS tools on virtually any system.
You just use implicit remoting to any DC, and proxy the cmdlets to the target.
The cmdlet run from the remote system, and are gone once you close the session.

Use PowerShell Active Directory Cmdlets Without Installing Any Software

Using PowerShell for Remote Server Administration in Windows 10 RTM without the RSAT tools

So, you can fix a block in your code to check for RSAT and if it is not there use implict remoting. Liek this discussion

Use Get-ADObject without installing RSAT