Jump to content


2SR82

Building Collections based on file content?

Recommended Posts

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?

Share this post


Link to post
Share on other sites

$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.

Share this post


Link to post
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.