Forum Discussion
Jackiesstrength
Mar 03, 2020Copper Contributor
Bulk edit for Azure groups
import-CSV c:\temp\awsgroups.csv | ForEach (Set-DistributionGroup -Identity $.DistGroup - ManagedBy @{Add="<owner1>","<owner2>","<owner3>" I need to do a bulk edit to our Azure groups to add 3 ow...
Joshua King
Mar 04, 2020MVP
Try changing:
$.DistGroup
To:
$_.DistGroup
Key here is that '$' by itself isn't a thing isn't a thing, but '$_' references the current item in your foreach loop.
Alternatively you can use $PSItem (e.g. $PSItem.DistGroup). I personally use $_ , but there's a discussion on Reddit on this if you're interested in reading people's thoughts on it.