Forum Discussion

SaraMalhas's avatar
SaraMalhas
Copper Contributor
May 30, 2020

The Foreach loop stopped working after installing edge chromium

HI 

   I'm used to do most of the office 365 groups by PowerShell scripts (exporting CSV & foreach loop to modify the group) . it was working fine for months, 

yesterday I deiced to install Microsoft chromium, & suddenly the script stopped working, it doesn't give any error it just like, it doesn't see the loop at all, anything I put inside it, it doesn't process even if it just write-host .

I have lost my mind over it, but the only thing I did in my pc yesterday was installing the new edge browser & it was working fine before it just half an hour. 

Does any one have any suggestion ? or experience something like this 

4 Replies

  • I doubt that the issue is coming from Edge Chromium. Can you please share a sample of the script?
    • SaraMalhas's avatar
      SaraMalhas
      Copper Contributor

      Ricardo Viana 

      me too, I even change the script so many times & used the exchange v2 module also, today I found out only the foreach with office 365 command is failing , adding members to a distribution group is fine.

       this is a sample 

      $UserCredential = Get-Credential
      $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
      Import-PSSession $Session
      Import-CSV "C:\temp\msteams_grp12.csv" | ForEach-Object {
      Add-UnifiedGroupLinks –Identity "msteams_grp12fsfs" –LinkType member –Links $_.member
      }

       

      I even used an identity that doesn't exist to see if I will get an error at least, but it pass by like nothing is there at all,

      • Ricardo Viana's avatar
        Ricardo Viana
        Iron Contributor
        It looks completely fine to me, could you double check if the CSV file is comma delimited and not ;? I know it might sound basic, but sometimes it happens(at least it happened to me when I was trying to reproduce your issue), and that's the only place I can see it failing

Resources