( BaT | 2022. 09. 17., szo – 01:42 )

Ha már berakod egy változóba, akkor így is írhatod:

$eee=Get-DnsServerDiagnostics
if ($eee.TcpPackets -and $eee.UdpPackets) {
  echo "Log file path: $($eee.LogFilePath)"
}

De meg lehet csinálni változó nélkül is:

Get-DnsServerDiagnostics |
  Where-Object { $_.TcpPackets -and $_.UdpPackets } |
  ForEach-Object { echo "Log file path: $($_.LogFilePath)" }