Parsing Powershell data from Get-ADReplicationUpToDatenessVectorTable

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
Partner : CN=NTDS Settings,CN=YOUROTHERDCHERE
PartnerInvocationId : daf3888f-762b-4ae3-8cc0-0934b00aa0e6
Server : YOURDCHERE
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?

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. :slight_smile:

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.

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

$var = # everything else 

Ok. I am noob.

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

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

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

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 :slight_smile:

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 'blogs.technet.microsoft.com/heyscriptingguy/2011/10/04/use-powershell-active-directory-cmdlets-without-installing-any-software'
Using PowerShell for Remote Server Administration in Windows 10 RTM without the RSAT tools 'mikefrobbins.com/2015/08/05/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 'powershell.org/forums/topic/use-get-adobject-without-installing-rsat'