Share via


Set-MsolGroup : Invalid value for parameter. Parameter Name: ManagedBy.


Set-MSOLUserGroup Set ManagedBy Property


Summary

Recently we implemented auditing users and groups in MS Online. To make a process document we need to set managed by property for Groups. So we can contact the manager for process changes.

Background

Before we begin let's explore the commands To Create Group

001
help New-MsolGroup -Detailed

To Modify Group

001
help Set-MsolGroup -Detailed

Parameter

By looking the syntax and documentation the ManagedBY parameter is a string. So we tried using Alias and UPN [User Principal Name]. No dice.

Error

001
Set-MsolGroup -ObjectId bce19744-f4a0-4ef1-ba35-2516d931cd5e -ManagedBy "Chendrayan"

Set-MsolGroup : Invalid value for parameter. Parameter Name: ManagedBy.

Solution

After a while we just tried passing the value of user Object ID. Voila, it worked!!!

001
002
003
004
005
$userID = Get-MsolUser -UserPrincipalName 'Chendrayan@Domain.onmicrosoft.com'
$userID.ObjectId
Set-MsolGroup -ObjectId bce19744-f4a0-4ef1-ba35-2516d931cd5e -ManagedBy $userID.ObjectId

Get-MsolGroup -ObjectId bce19744-f4a0-4ef1-ba35-2516d931cd5e | Select ManagedBy

Screenshots