May 30 2020 02:25 AM
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
May 30 2020 02:22 PM
May 30 2020 02:31 PM
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,
May 30 2020 03:25 PM - edited May 30 2020 03:30 PM
May 30 2020 03:31 PM
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}