it's a little bit hard to explain, but I want to write PowerShell script to search each interfaces that is configured in the set protocol ospf area statement to identify if any interface is not configured with authentication md5. if any interface is found while looping thru each interface, then I want to break out the loop and write-host "not compliant".
Below is my script. I skipped the first part of the script that scans each line in the config and do a select-string to find all the matches in the set protocols ospf area 0.0.0.0 interface vlan xxxx and stored in the $ospf_interface
foreach($interface in $ospf_interface)
{
$md5 = Select-string -path c:\config.txt -pattern "set\sprotocols\sospf\sarea\s0.0.0.0\sinterface\svlan\s\d{1,2}\sauthentication\smd5.*"
if($md5) ##if md5 is found in the string, then write-host
{
Write-host "found"
{break}
}
### it does not seem to work correctly