Skip to content

Commit b7cdda5

Browse files
committed
fixup
1 parent 223171f commit b7cdda5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

scripts/aad-replace-owner-with-a-different-one/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
Find all the Microsoft 365 Groups that a user is an Owner of and replace them with someone else useful for when an employee leaves and ownership needs to be updated.
88

9+
Example usage of CLI for Microsoft 365 sample:
10+
11+
![Example CLI for Microsoft 365](assets/exampleCLI.png)
12+
913
# [PnP PowerShell](#tab/pnpps)
1014

1115
```powershell
@@ -166,7 +170,7 @@ process {
166170
167171
if ($PSCmdlet.ShouldProcess($group.displayName, "Replace owner '$OldOwnerUpn' with '$NewOwnerUpn'")) {
168172
Write-Host " Adding '$NewOwnerUpn' as owner"
169-
$addOutput = & m365 entra m365group user add --groupId $group.id --userName $NewOwnerUpn --role Owner --output json 2>&1
173+
$addOutput = & m365 entra m365group user add --groupId $group.id --userNames $NewOwnerUpn --role Owner --output json 2>&1
170174
if ($LASTEXITCODE -ne 0) {
171175
Write-Warning " Failed to add '$NewOwnerUpn'. CLI: $addOutput"
172176
$Summary.ReplacementFails++
@@ -175,7 +179,7 @@ process {
175179
}
176180
177181
Write-Host " Removing '$OldOwnerUpn' as owner"
178-
$removeArgs = @('entra', 'm365group', 'user', 'remove', '--groupId', $group.id, '--userName', $OldOwnerUpn, '--output', 'json')
182+
$removeArgs = @('entra', 'm365group', 'user', 'remove', '--groupId', $group.id, '--userNames', $OldOwnerUpn, '--output', 'json')
179183
if ($Force) { $removeArgs += '--force' }
180184
181185
$removeOutput = & m365 @removeArgs 2>&1
@@ -242,6 +246,7 @@ end {
242246
|-----------|
243247
| Reshmee Auckloo |
244248
| [Ganesh Sanap](https://ganeshsanapblogs.wordpress.com/) |
249+
| Adam Wójcik |
245250

246251

247252
[!INCLUDE [DISCLAIMER](../../docfx/includes/DISCLAIMER.md)]
194 KB
Loading

scripts/aad-replace-owner-with-a-different-one/assets/sample.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
{
7171
"gitHubAccount": "Adam-it",
7272
"company": "",
73-
"pictureUrl": "https://avatars.githubusercontent.com/u/45694692?v=4",
73+
"pictureUrl": "https://avatars.githubusercontent.com/u/58668583?v=4",
7474
"name": "Adam Wójcik"
7575
}
7676
],

0 commit comments

Comments
 (0)