Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Should I be able to compare string with system.string?

$
0
0

Should I able to compare these two arrays using the compare-object command given the IP of one is a "string" and the other is "system.string"? If so how? I'm trying to check that all values in $RecordsToRemove exist in $ExistingRecords before deleting them. 

Thanks

PS C:\Users\a> $RecordsToRemove | Get-Member 


   TypeName: Selected.System.Management.Automation.PSCustomObject

Name        MemberType   Definition
----        ----------   ----------
Equals      Method       bool Equals(System.Object obj)
GetHashCode Method       int GetHashCode()
GetType     Method       type GetType()
ToString    Method       string ToString()
hostname    NoteProperty string hostname=comp1
IP          NoteProperty string IP=10.1.2.3


PS C:\Users\a> $ExistingRecords | Get-Member


   TypeName: Selected.Microsoft.Management.Infrastructure.CimInstance

Name        MemberType   Definition
----        ----------   ----------
Equals      Method       bool Equals(System.Object obj)
GetHashCode Method       int GetHashCode()
GetType     Method       type GetType()
ToString    Method       string ToString()
Hostname    NoteProperty string Hostname=comp1
IP          NoteProperty System.String IP=10.1.2.3


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>