I'm struggling with this code:
Get-Sensor -Name Ping | where {$_.Tags -like "Kat.A" -or $_.Tags -like "Kat.B" -or $_.Tags -like "Kat.C" -or $_.Tags -like "Kat.D"} | Select-Object Device, Tags
I get these values via. Connect-PrtgServer. The output data for this is:
DEVICENAME {Kat.C}
DEVICENAME {Kat.B, C_OS_Win}
DEVICENAME {Kat.A, pingsensor}
DEVICENAME {Kat.A}
DEVICENAME {Kat.A, pingsensor} DEVICENAME {Kat.D}
DEVICENAME {Kat.D, pingsensor} DEVICENAME {Kat.B}
In this case, I want the other way around. I want to use -notlike to get all object, which doesn't have a "Kat.A, Kat.B, Kat.C or Kat.B" Tag. So I changed the code to:
Get-Sensor -Name Ping | where {$_.Tags -notlike "Kat.A" -or $_.Tags -notlike "Kat.B" -or $_.Tags -notlike "Kat.C" -or $_.Tags -notlike "Kat.D"} | Select-Object Device, Tags
But here is problem, that I get more values than needed:
DEVICENAME {Kat.D, test}
DEVICENAME {Kat.C, sql}
DEVICENAME {Kat.D, domaincontroller}
DEVICENAME {pingsensor, memberserver}
DEVICENAME {pingsensor, memberserver}
DEVICENAME {pingsensor, memberserver}
DEVICENAME {pingsensor, memberserver}
DEVICENAME {Kat.C}
I only need those four devices/tags which starts with pingsensor, because they don't contain a Kat.
Thank you for your upcoming help guys.
Best regards :)