this is my code
$Packets = @()
$Packets += Test-PXESever -ProcessorArchitecture 0 -Verbose
$Packets += Test-PXESever -ProcessorArchitecture 7 -Verbose
The output of the array $Packets looks like this:
Op : BootResponse
HType : Ethernet
HLen : 6
Hops : 0
XID : E72347EB
Secs : 0
Flags : {Broadcast}
CIAddr : 0.0.0.0
SIAddr : 10.164.28.3
SName :
File :
Op : BootResponse
HType : Ethernet
HLen : 6
Hops : 0
XID : E72347EB
Secs : 0
Flags : {Broadcast}
CIAddr : 10.164.28.74
SIAddr : 164.3.15.61
File : smsboot\Ps02\x86\pxe.com
I want to check if $Packets contains the string "smsboot" and if $Packets contains the string "164.3.15.61"
In this case it does. So I tried to do:
if($Packets -contains "smsboot"){
Write-Host "Contains smsboot"}
else {Write-Host "Does not contain smsboot"}
and same with the IP address. But it always says it does not contain the strings, although it does. What am I doing wrong?
thanks!