compare-object command is used to compare two object arrays they can be different types of objects for example an object array from xml compared to object array of csv file data
for my example I used it to compare two different types of crm objects
we use bespoke tool to get crm records with in powershell, but idea here to show the use of compare-object
Compare-object -referenceobject (get-crmrecord -connect http://kuksolutiondev01/org1 -entityname kuk_configurations) -differenceobject (get-crmrecord -connect http://kuksolutiondev02/org4 -entityname kuk_configurations)
Output of above command is like
InputObject SideIndicator
@{Id=7215239d-ddkd-kdld-kdkdfd44c342; Ent... =>
@{Id=7215239d-ddkd-kdld-kdkdkdkf4das; Ent... =>
@{Id=7215fdsf-ddkd-kdld-kdkdfdsa23dkd; Ent... <=
@{Id=72152342-ddkd-kdld-d543fsdakdkd; Ent... =>
@{Id=721523jkl-fdsad-kdk34fdsajkdkdkd; Ent... <=
=> says the difference is found in the http://kuksolutiondev02/org2=4 and <= says difference is in http://kuksolutiondev01/org1
to find the full details of the input object use fl * in the pipeline
Compare-object -referenceobject (get-crmrecord -connect http://kuksolutiondev01/org1 -entityname kuk_configurations) -differenceobject (get-crmrecord -connect http://kuksolutiondev02/org4 -entityname kuk_configurations) | fl *
for my example I used it to compare two different types of crm objects
we use bespoke tool to get crm records with in powershell, but idea here to show the use of compare-object
Compare-object -referenceobject (get-crmrecord -connect http://kuksolutiondev01/org1 -entityname kuk_configurations) -differenceobject (get-crmrecord -connect http://kuksolutiondev02/org4 -entityname kuk_configurations)
Output of above command is like
InputObject SideIndicator
@{Id=7215239d-ddkd-kdld-kdkdfd44c342; Ent... =>
@{Id=7215239d-ddkd-kdld-kdkdkdkf4das; Ent... =>
@{Id=7215fdsf-ddkd-kdld-kdkdfdsa23dkd; Ent... <=
@{Id=72152342-ddkd-kdld-d543fsdakdkd; Ent... =>
@{Id=721523jkl-fdsad-kdk34fdsajkdkdkd; Ent... <=
=> says the difference is found in the http://kuksolutiondev02/org2=4 and <= says difference is in http://kuksolutiondev01/org1
to find the full details of the input object use fl * in the pipeline
Compare-object -referenceobject (get-crmrecord -connect http://kuksolutiondev01/org1 -entityname kuk_configurations) -differenceobject (get-crmrecord -connect http://kuksolutiondev02/org4 -entityname kuk_configurations) | fl *