I’m not sure where to start with this one so apologies in advance if it seems confused.
I would like to query the contents of a .DAT file (.txt format) for a specific text string. Ideally it needs to return an error level so I can then determine a follow up command if required. I’m not sure this kind of thing is possible?
I’ll give the scenario for more context. I am required to update the connection settings for Juniper VPN clients on End User Devices. I only want to update clients which don’t have a specific text string in the connection file (.DAT file). So I’d like to put together a script which first queries the connection file and then runs a command based on the response of the query.
From the research I’ve already done, this kind of thing only seems to be possible with SQL. I have considered going down the route of comparing one file with another but I think that is too open to false negatives.
Any help would be greatly appreciated.
Update
I've managed to use PowerShell to query the file:
get-content -path 'C:\Program Files\Common Files\Juniper Networks\ConnectionStore\connstore.bak' | where-object {$_ -like '*DR Connection*'}
friendly-name: "DR Connection"
I thought I would post my final script which solved my problem just in case anybody else has come across this issue.
Thanks