The Foreach loop stopped working after installing edge chromium

New Contributor

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?

@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,

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

 

@Ricardo Viana 

The thing is,  I took the exact same script & the exact same CSV & put it in another workstation & it works fine. I just out of ideas.

& what ever I put in the Foreach loop is doesn't see it at all, like it doesn't exists . I keep putting wrong statement or even hi commands also the same but in the same machine today this script worked 

$365Logon = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $365Logon -Authentication Basic -AllowRedirection
Import-PSSession $Session
Import-Csv “C:\Temp\cbe_ped.csv” | foreach{Add-DistributionGroupMember -Identity "cbe_ped" -Member $_.member}