Sign in to follow this  
Followers 0
gcue

multiple key names under same INI section

5 posts in this topic

heres what im trying to do...

find all the PCs in a given subnet and enter them into an INI file like so:

[LOCATION1_ASSETS]

JEM=D0056979

OSREC52=D0095304

this becomes a problem when one of the users has two PCs! bc as some of you mentioned, you cant have multiple entries with the same key name.

how can i add a 2 if the entry already exists?

If FileExists ("\\" & $aResult & "\c$") Then

$user=RegRead("\\" & $aResult & "\HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Altiris Agent\Inventory", "PrimaryUser")

$usr=StringSplit($user,"\")

If @error Then

ContinueLoop

EndIf

IniWrite($ini, "LOCATION1_ASSETS", $usr[2], $aResult)

EndIf

Share this post


Link to post
Share on other sites



Seperate the values with commas when you save them and then use stringsplit to get them back out.

Share this post


Link to post
Share on other sites

clever idea.

but i think when the ini is being read.. having the same values will confuse it.

Share this post


Link to post
Share on other sites

clever idea.

but i think when the ini is being read.. having the same values will confuse it.

Huh? What do you mean having the same values? If a user has two or more PCs save them as weaponx suggested, i.e.:

[LOCATION1_ASSETS]
JEM=D0056979,D0098923
OSREC52=D0095304

Share this post


Link to post
Share on other sites

the script doesnt know how to handle multiple PCs per user

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0