Skip to content

Building Collections based on file content?

Featured Replies

Hi,


is it possible to build a collection based on the content of a cfg/txt file?


i have an program which can be used with different licences.

the basic data of the program are the same. it only differs in one single config file where stands a path to a different file on a server.


Is there a way to analyse the content of a specific line in that file and build collections based on that content?

$ErrorActionPreference="Stop"
$file = $env:LOCALAPPDATA + "Low\Sun\Java\Deployment\security\exception.sites"
$servers = @(
 "http://yoururlhere.com",
 "https://anotherurl.net"
)
if(Test-Path $file){
    foreach($server in $servers){
        if(!(Select-String $file -pattern $server)){return($false)}
    }
 }
 else{return($false)}
return($true)

You can do that by creating a compliance rule. Based on the deployment of the rule you can create compliant, non compliant and error collections.

 

Here is a little sample script to check multiple strings against a local file.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.