detail<\/strong> what it is you’re attempting to do and explain (describe) your data set(s). Submitting files to look at does not help me understand your end goal or what the data is and how the data relates.<\/p>","upvoteCount":1,"datePublished":"2021-04-27T12:59:31.000Z","url":"https://community.spiceworks.com/t/array-in-hash-table-having-duplicates/797904/10","author":{"@type":"Person","name":"mike9019","url":"https://community.spiceworks.com/u/mike9019"}},{"@type":"Answer","text":"Mike<\/p>\n
I just need one line for every client , in that line first entry should be client , then pool ( no duplicate pool ) , then db ( again no duplicate ) then line ends with DD ( again no duplicate ). I have file( pool_dd) which has line pool to DD relation ( here no duplicate entry). dups file has pool , client and db value, here we have client repeated with different pool and db values.<\/p>\n
Thanks again<\/p>","upvoteCount":0,"datePublished":"2021-04-27T15:20:48.000Z","url":"https://community.spiceworks.com/t/array-in-hash-table-having-duplicates/797904/11","author":{"@type":"Person","name":"spiceuser-evezb","url":"https://community.spiceworks.com/u/spiceuser-evezb"}},{"@type":"Answer","text":"
What do you consider a duplicate - which value is supposed to be unique between your data sets; the client, pool, dd, and/or db?<\/p>\n
Here’s an example of the most recent files you sent for dups and pool_dd;<\/p>\n
pool_dd.txt has a DD named “JCBDD1300P” 26 times - each of those with a unique ‘pool’ value.<\/p>\n
dups.txt has a client named “bpdppa300p.corpads.local”. Taking the dups.txt pool value of ‘JC_CloudTier_01’ against that client it shows two different db (File, DB2).<\/p>\n
What would you expect your end result to be with this example?<\/p>\n
The way in which the current script works you should get at least two results;<\/p>\n
client,pool,db,dd\nbpdppa300p.corpads.local, JC_CloudTier_01,File, JCBDD1300P\nbpdppa300p.corpads.local, JC_CloudTier_01,DB2, JCBDD1300P\n<\/code><\/pre>\nAre these considered duplicates since client, pool, and DD match? The DB differs so not a duplicate to me. This is what I mean by describing your data and explaining in detail<\/strong> your goal.<\/p>","upvoteCount":0,"datePublished":"2021-04-27T15:47:51.000Z","url":"https://community.spiceworks.com/t/array-in-hash-table-having-duplicates/797904/12","author":{"@type":"Person","name":"mike9019","url":"https://community.spiceworks.com/u/mike9019"}},{"@type":"Answer","text":"If you see below line from output file…<\/p>\n
rsdbpc03.corpads.local,MN_DR MN_INCR_FS MN_DR MN_INCR ,File DB2 DB2 ,JCBDD1300P MNBDD3302P JCBDD1300P MNBDD3302P<\/p>\n
pools are MN_DR MN_INCR_FS MN_DR MN_INCR , here MN_DR came two times<\/p>\n
db are File DB2 DB2 , here DB2 came two times<\/p>\n
dd are JCBDD1300P MNBDD3302P JCBDD1300P MNBDD3302P , here JCBDD1300P came out two times same for MNBDD3302P<\/p>\n
So i want ouput look like<\/p>\n
rsdbpc03.corpads.local,MN_DR MN_INCR_FS MN_INCR ,File DB2,JCBDD1300P MNBDD3302P<\/p>","upvoteCount":0,"datePublished":"2021-04-27T15:57:59.000Z","url":"https://community.spiceworks.com/t/array-in-hash-table-having-duplicates/797904/13","author":{"@type":"Person","name":"spiceuser-evezb","url":"https://community.spiceworks.com/u/spiceuser-evezb"}},{"@type":"Answer","text":"
Much better explanation!<\/p>\n
Your current issues can be explained by the data coming in. I took your dups and pool files and imported into Excel. Using PowerQuery I did a left inner join on pool.pool = dups.pool.<\/p>\n
Filtering on client ‘rsdbpc03.corpads.local’ you can see why;<\/p>\n
MN_DR came in twice, because there’s two results for MN_DR pool that have two different DBs.<\/p>\n
DB2 came in twice because there are two different<\/em> pools with the same DB.<\/p>\nJCBDD1300P and MNBDD3302P came in twice because each of those have two different pools and DBs.<\/p>\n
Now that you can visualize the data maybe you can try and come up with a solution <\/p>\n
<\/p>\n
<\/p>","upvoteCount":0,"datePublished":"2021-04-27T16:20:52.000Z","url":"https://community.spiceworks.com/t/array-in-hash-table-having-duplicates/797904/14","author":{"@type":"Person","name":"mike9019","url":"https://community.spiceworks.com/u/mike9019"}},{"@type":"Answer","text":"
Let me ask you if we parse output file line by line , read pool info and remove reoccurrence and do same for db an dd ?<\/p>\n
Using split by , ( comma ) then parse each output and look for duplicates ? then put together in line . is this duable ?<\/p>\n
Now my original question why array in hash table appending same value when i used “notin” match operation. If i am appending space to value , it should take entire thing and do look up ( adding space so each one is separated by space ).<\/p>\n
Thank you<\/p>","upvoteCount":0,"datePublished":"2021-04-27T16:46:37.000Z","url":"https://community.spiceworks.com/t/array-in-hash-table-having-duplicates/797904/15","author":{"@type":"Person","name":"spiceuser-evezb","url":"https://community.spiceworks.com/u/spiceuser-evezb"}},{"@type":"Answer","text":"\n\n
<\/div>\n
spiceuser-evezb:<\/div>\n
\nLet me ask you if we parse output file line by line , read pool info and remove reoccurrence and do same for db an dd ?<\/p>\n
Using split by , ( comma ) then parse each output and look for duplicates ? then put together in line . is this duable ?<\/p>\n<\/blockquote>\n<\/aside>\n
Try it - see what happens I prefer to manipulate the data before sending it out then reading it back in but if it gets you where you need to be there’s no real issue that I can tell besides a possible performance hit. May or may not be relevant depending on the size of your data sets.<\/p>\n
\nNow my original question why array in hash table appending same value when i used “notin” match operation. If i am appending space to value , it should take entire thing and do look up ( adding space so each one is separated by space ).<\/p>\n
Thank you<\/p>\n<\/blockquote>\n
This was explained here: array in hash table having duplicates<\/a><\/p>","upvoteCount":0,"datePublished":"2021-04-27T18:11:35.000Z","url":"https://community.spiceworks.com/t/array-in-hash-table-having-duplicates/797904/16","author":{"@type":"Person","name":"mike9019","url":"https://community.spiceworks.com/u/mike9019"}}]}}
Neally
(Neally)
April 23, 2021, 8:13pm
2
Welcome.
If you post code, please use the ‘Insert Code’ button. Please and thank you!
Hi, and welcome to the PowerShell forum!
Don’t apologize for being a “noob” or “newbie” or “n00b.” There’s just no need – nobody will think you’re stupid, and the forums are all about asking questions. Just ask!
Use a descriptive subject. Don’t say “Need help” or “PowerShell Help”, actually summarize what the problem is. It helps the rest of us keep track of which problem is which.
Don’t post massive scripts. We’re all volunteers and we don’t have time to read all that, nor will we copy…