Skip to content

Commit 3c4e4ae

Browse files
authored
Merge pull request #103810 from riantu/patch-18
Replace PowerShell methods that don't work
2 parents 3f2c798 + fe688ab commit 3c4e4ae

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

articles/active-directory/hybrid/how-to-connect-modify-group-writeback.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This article walks you through the options for modifying the default behaviors o
2828

2929
If the original version of group writeback is already enabled and in use in your environment, all your Microsoft 365 groups have already been written back to Active Directory. Instead of disabling all Microsoft 365 groups, review any use of the previously written-back groups. Disable only those that are no longer needed in on-premises Active Directory.
3030

31-
### Disable automatic writeback of all Microsoft 365 groups
31+
### Disable automatic writeback of new Microsoft 365 groups
3232

3333
To configure directory settings to disable automatic writeback of newly created Microsoft 365 groups, use one of these methods:
3434

@@ -45,13 +45,32 @@ To configure directory settings to disable automatic writeback of newly created
4545

4646
- Microsoft Graph: Use the [directorySetting](/graph/api/resources/directorysetting?view=graph-rest-beta&preserve-view=true) resource type.
4747

48-
### Disable writeback for each existing Microsoft 365 group
48+
### Disable writeback for all existing Microsoft 365 group
49+
50+
To disable writeback of all Microsoft 365 groups that were created before these modifications, use one of the folowing methods:
4951

5052
- Portal: Use the [Microsoft Entra admin portal](../enterprise-users/groups-write-back-portal.md).
51-
- PowerShell: Use the [Microsoft Identity Tools PowerShell module](https://www.powershellgallery.com/packages/MSIdentityTools/2.0.16). For example:
53+
- PowerShell: Use the [Microsoft Graph PowerShell SDK](/powershell/microsoftgraph/installation?view=graph-powershell-1.0&preserve-view=true). For example:
54+
55+
```PowerShell
56+
#Import-module
57+
Import-module Microsoft.Graph
58+
59+
#Connect to MgGraph and select the Beta API Version
60+
Connect-MgGraph -Scopes Group.ReadWrite.All
61+
Select-MgProfile -Name beta
62+
63+
#List all Microsoft 365 Groups
64+
$Groups = Get-MgGroup -All | Where-Object {$_.GroupTypes -like "*unified*"}
65+
66+
#Disable Microsoft 365 Groups
67+
Foreach ($group in $Groups)
68+
{
69+
Update-MgGroup -GroupId $group.id -WritebackConfiguration @{isEnabled=$false}
70+
}
71+
> We recomend using Microsoft Graph PowerShell SDK with [Windows PowerShell 7](/powershell/scripting/whats-new/migrating-from-windows-powershell-51-to-powershell-7?view=powershell-7.3&preserve-view=true)
5272
53-
`Get-mggroup -filter "groupTypes/any(c:c eq 'Unified')" | Update-MsIdGroupWritebackConfiguration -WriteBackEnabled $false`
54-
- Microsoft Graph: Use a [group object](/graph/api/group-update?tabs=http&view=graph-rest-beta&preserve-view=true).
73+
- Microsoft Graph Explorer: Use a [group object](/graph/api/group-update?tabs=http&view=graph-rest-beta&preserve-view=true).
5574
5675
## Delete groups when they're disabled for writeback or soft deleted
5776

0 commit comments

Comments
 (0)