Querying for Security Information

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
goldyfarbs
Posts: 239
Joined: Wed Oct 10, 2007 10:08 pm

Querying for Security Information

Post by goldyfarbs » Mon Oct 15, 2007 3:38 am

Jeff,

I am still having problems understanding the ArrLines. Don't I have to feed in ArrLines as a dynamic value of the file we are reading?

User avatar
jhicks
Posts: 1789
Joined: Sun Jan 21, 2007 11:31 pm

Querying for Security Information

Post by jhicks » Mon Oct 15, 2007 4:20 am

The contents of the array I'm using are just to demonstrate the functions and Select Case statements. As long as you understand how the array is being enumerated, that's all that matters. The array code I'm using is in place of the code you are using the read the config file.

User avatar
goldyfarbs
Posts: 239
Joined: Wed Oct 10, 2007 10:08 pm

Querying for Security Information

Post by goldyfarbs » Mon Oct 15, 2007 5:29 am

As long as you understand how the array is being enumerated, that's all that matters. The array code I'm using is in place of the code you are using the read the config file.

Jeff,

That is the problem.. I am having a hard time understanding how the array is being enumerated.. Man, It just isn't clicking yet for me.. Don't give me the answer, just help me direct my thoughts in the correct way...

Any help is much appreciated..
thx

User avatar
jhicks
Posts: 1789
Joined: Sun Jan 21, 2007 11:31 pm

Querying for Security Information

Post by jhicks » Mon Oct 15, 2007 4:13 pm

I think you're making this more difficult for yourself than it needs to be. Conceptually, when you read in the text file, each line is like the line in my array. You don't have to create an array. I used an array in lieu of reading a text file. Your text file has lines similar to what I was testing with. I created something static but you are using something dynamic.

User avatar
jvierra
Posts: 13730
Joined: Tue May 22, 2007 9:57 am
Contact:

Querying for Security Information

Post by jvierra » Tue Oct 16, 2007 1:18 am

I believe that, for what you are trying to do, reading th e whole file into a varaiable and then scanning it for the string in question would be easiest.

Also not that ALL policy settings returned by SecEdit scans are stored as registry settings which are much easier to read.

If you need to do a large number of security validations per server then using PowerShell text mamanement with NET text/string classes is much more powerful and flexible.

If, however, you are only looking for one or two simple settings then your method will work. Use Jeff's suggestion of rading the file a line ata atime and scan the line for matches to strings of interest.

To save time you could scan for "audit" and then scan for more detail if "audit" is found.

User avatar
goldyfarbs
Posts: 239
Joined: Wed Oct 10, 2007 10:08 pm

Querying for Security Information

Post by goldyfarbs » Tue Oct 16, 2007 2:19 am

Jeff - I totally agree with you that I am making this more difficult than it probably is... And that is because I don't fully understand ...


I believe that, for what you are trying to do, reading th e whole file into a varaiable and then scanning it for the string in question would be easiest.


Now, That is correct, I want to read the text file and create a variable as than..

So, I have tried this, but no success.

strFilePath = "C:seccfg.txt" Set fso = CreateObject("Scripting.FileSystemObject") Set fsostr = fso.OpenTextFile(strFilePath, 1, False, -2)Do Until fsostr.AtEndOfStream sLine = fsostr.ReadAllLoop
arrLines=Array(sLine)
"""

That doesn't return anything.. Again, I think I am making this too difficult, but that is only b/c I don't understand, but I am giving my best shot..

Thanks for both of your patience...

Locked