Hello.
I am trying to parse multiply emails from a folder in Outlook, whenever I run the script on 1 user the script runs perfectly.
When I run the script on two users, ConvertFrom-StringData throws me an error;
ConvertFrom-StringData : Data item 'Medarbejdertype' in line 'Medarbejdertype=Praktikant' is already defined. At C:\Users\Steve\OneDrive\PowerShell_Scripts\FITIT.ps1:21 char:99As far as I could tell from the error output it seems like the hash-table($data in this case) did not reset itself at the end of the loop.
So I have tried to clear it with the following cmdlets/methods/declaring;
$data.clear() $data = @{} Clear-Variable -Name $dataEven through I can see that the hash-table is cleared on the second run PowerShell throws me that error stated above.
I’ve been googling, read the documentation but as far as I can tell I have used it correctly?
I don’t know if it is my understanding of line 21 that might be too poor, I recived a lot of help with that one from PowerShell slack user @Chrisdent I belive it was.
Could anyone tell me what I am doing wrong? Or maybe link me to something that could get me back on track? I feel completly lost as what the next step is.
Best Regards.
STPE
Code I am using: