Show new and old value in Change History report via Powershell

Hi, 

I would like to export user information from Change history. I need to see information hat the value has been changed from -> to . 

For example my current script is 

Get-QARSOperation -TargetObject $user -SizeLimit 2 |
Select-Object @{Name="AttributeChanges";Expression={$_.AttributeChanges.Name -join ','}},@{ name="Perp"; expression= {$_.InitiatorInfo.NTAccountName }}, @{ name="Victim"; expression={ $_.TargetObjectInfo.dn }}, @{ name="Date"; expression={ $_.TargetObjectInfo.dn }}

It gives me date, initiator and target name and attribute which has been changed. However, I would like to see what was the old and new value of attribute, which has been changed (in my case for tets pursposes it is phonenumber).

Thanks.

  • Unfortunately, it does not appear that the Management Shell cmdlet Get-QARSOperation exposes the old or previous value. You can obtain the new value through 'AttributeChanges.Values', as in the following example:

    Get-QARSOperation -TargetObject $user -SizeLimit 2 |
    Select-Object @{Name="AttributeChanges";Expression={$_.AttributeChanges.Name -join ','}},
    @{ name="Perp"; expression= {$_.InitiatorInfo.NTAccountName }},
    @{ name="Victim"; expression={ $_.TargetObjectInfo.dn }},
    @{ name="Date"; expression={ $_.Initiated }},
    @{ name="New Value"; expression={ $_.AttributeChanges.Values }}

    This will produce the following output:

    AttributeChanges : telephoneNumber
    Perp : DEV\mn1
    Victim : CN=Mark,OU=Users,OU=Target,DC=xyz,DC=abc
    Date : 6/10/2020 10:03:19 AM
    New Value : (555) 888-9999

    AttributeChanges : telephoneNumber
    Perp : DEV\mn1
    Victim : CN=Mark,OU=Users,OU=Target,DC=xyz,DC=abc
    Date : 6/10/2020 10:02:42 AM
    New Value : 555-111-2222