Помогите пожалуйста. Я хочу, чтобы вывод отображал
interface vlan1 is not configured with ospf
interface vlan3 is configured with ospf
interface vlan7 is configured with ospf
но вывод, который я получил при запуске этого скрипта ниже,
interface vlan1 interface vlan3 interface vlan7 is configured with ospf
$interface = select-string -path c:\doc\config.txt -pattern "interface\vlan\d{1,3} -context 0, 3
$ospf = Select-string -inputobject $interface -pattern "ip ospf message-digest.*" | % {$_.matches.value}
if ($ospf -ne $null)
{
$int = $ interface | select -expandproperty line #don't want to show line#
write-host "$int is configured with ospf"
}
else
{
$int = $ interface | select -expandproperty line #don't want to show line#
Write-host "$int is not configured with ospf"
}
interface Vlan1
no ip address
shutdown
!
interface Vlan3
ip ospf message-digest-key 100 md5 7 aa93naf
!
interface Vlan7
standby 38 preempt
ip ospf message-digest-key 100 md5 7 asf9394