Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Detect occurence of 2 keys in relation with similar content in inifile section and delete the redundant Section where this occurance will match

$
0
0

Please can somebody help me to solve the following task in powershell. May be that i am not experienced enough in powershell to find the right way in solving the following complex task.

I am searching methods and code snippets in powershell, which will help me to detect double entries in different ini-file sections, as shown (one match) in example ini-file listed below.  When i have found matches i want to eliminate the complete redundant sections, except one that should be left untouched.

Search criteria: Always when both of the keys UserGroup and in the keys Arguments= have similar entries in different sections, (entries marked underlined) (occuring in different sections SASIMAP and SASOLAP), then the complete redundant sections should be deleted.

[SASIMAP]
FileName=C:\Program Files (x86)\VBScript\CScript.exe
Arguments="C:\Windows\Application Compatibility Scripts\Logon\SASEGUIDEADM4.vbs" //B //NoLogo //T:60
UserGroups=Domainname\gl_w_SASIMAP
Description=SASIMAP
Wait=0
WindowStyle=1
[SASOLAP]
FileName=C:\Program Files (x86)\VBScript\CScript.exe
Arguments="C:\Windows\Application Compatibility Scripts\Logon\SASEGUIDEADM4.vbs" //B //NoLogo //T:60
UserGroups=Domainname\gl_w_SASIMAP
Description=SASOLAP
Wait=0
WindowStyle=1

Has somebody an idee or example code to solve this task ?


Viewing all articles
Browse latest Browse all 6937

Trending Articles