How do I set msExchMailboxGUID using powershell or any other method?
Continuing from your example, this would work:
$guid = $user.get("msExchMailboxGUID")
$thisDN2 = $twoUser.DistinguishedName
$user2 = [ADSI]"LDAP://$thisDN2"
$user2.put('msExchMailboxGUID', @($guid))
$user2.setinfo()

Juanjo Daza
Updated on September 18, 2022Comments
-
Juanjo Daza 11 months
I need to set the msExchMailboxGUID for many accounts in bulk. My input for this data comes from the Powershell command Get-MailboxStatistics. In it is an object that has the GUID for the mailbox.
I need to save that GUID into AD, so this is what I'm doing to GET the object:
$thisDN = $oneUser.DistinguishedName $user = [ADSI]"LDAP://$thisDN" try { $user.get("msExchMailboxGUID") } catch { $desc = "" }
What is the correct way to Set the object?
I'm unable to use "set" or "put" to upload and save the error. It would even be better if someone can point me to detailed object details since I'm not sure where to look for details on something that is instantiated with the
[ADSI]
brackety thing.If this is just using the COM ADSI objects, then what is the correct syntax for "put"? I've tried parentheses, commas, and am unable to get Powershell to talk COM.
-
jscott over 10 yearsDo you not have available the Microsoft ActiveDirectory modules included with RSAT? Are you using ADSI for a specific reason?
-
Juanjo Daza over 10 years@jscott I thought ADSI was the way... perhaps this is a lot easier than I thought. What term should I google? My search terms lead me down the ADSI path.
-
Juanjo Daza over 10 yearsHmmm seems like
Import-Module ActiveDirectory
may help me
-