Hi all,
I'm creating some automation scripts for Office 365 to add mailboxes to eDiscovery as part of an offboarding process. So a user's mailbox will be added to legal hold and then the AD object is deleted. I want to keep some data about the user in
each new mailbox search. The mailbox search has got a "Description" property on Office 365... basically a big text box where u can keep a description of each mailbox search.
Long story short, I'm building a string variable which has all the data of the user which I will ultimate use when I create the new mailbox search object. To achieve this, I run a command on office365 and this holds the user properties in an object...like:
$MsolUser = Get-MsolUser -UserPrincipalName $UserUPNToOffboard
This gives me a whole bunch of data if I run $MsolUser | fl ... for example:
PS C:\> $MsolUser | fl
ExtensionData : System.Runtime.Serialization.ExtensionDataObject
AlternateEmailAddresses : {test@test.com}
AlternateMobilePhones : {}
AlternativeSecurityIds : {}
BlockCredential : True
City :
CloudExchangeRecipientDisplayType : 1073741824
Country :
Department : Information Services
DisplayName : Test User
Errors : {Microsoft.Online.Administration.ValidationError,
Microsoft.Online.Administration.ValidationError}
Fax :
FirstName : test
ImmutableId : rcmeg5BX002hsl0oXcEs1A==
IsBlackberryUser : False
IsLicensed : False
LastDirSyncTime : 10/30/2014 6:24:17 PM
LastName : test
LastPasswordChangeTimestamp : 9/12/2014 3:35:06 PM
LicenseReconciliationNeeded : False
Licenses : {}
LiveId : 10037FFE8A4F6083
MobilePhone :
ObjectId : 918265f1-12ba-4874-a330-5f2fc514fa2c
Office : Head Office
OverallProvisioningStatus : None
PasswordNeverExpires : True
PasswordResetNotRequiredDuringActivate :
PhoneNumber :
PortalSettings :
PostalCode :
and so forth.
Now, I want that FL data in my description box... I'm trying to build this into a variable, and my first part of my "description building" is:
$Description = "eDiscovery mailbox hold for offboarded user $DisplayName. `n `n MSOL Dump:
So... first part works ($Displayname comes from $DisplayName = $MsolUser.DisplayName). But for the life of me I can't get that object and all it's properties and values into that variable...
In the end, I want my $Description variable to look something like this:
eDiscovery mailbox hold for offboarded user Test User.
MSOL Dump:
ExtensionData : System.Runtime.Serialization.ExtensionDataObject
AlternateEmailAddresses : {test@test.com}
AlternateMobilePhones : {}
AlternativeSecurityIds : {}
BlockCredential : True
City :
CloudExchangeRecipientDisplayType : 1073741824
Country :
Department : Information Services
DisplayName : Test User
Errors : {Microsoft.Online.Administration.ValidationError,
Microsoft.Online.Administration.ValidationError}
Fax :
FirstName : test
ImmutableId : rcmeg5BX002hsl0oXcEs1A==
IsBlackberryUser : False
IsLicensed : False
LastDirSyncTime : 10/30/2014 6:24:17 PM
LastName : test
LastPasswordChangeTimestamp : 9/12/2014 3:35:06 PM
LicenseReconciliationNeeded : False
Licenses : {}
LiveId : 10037FFE8A4F6083
MobilePhone :
ObjectId : 918265f1-12ba-4874-a330-5f2fc514fa2c
Office : Head Office
OverallProvisioningStatus : None
PasswordNeverExpires : True
PasswordResetNotRequiredDuringActivate :
PhoneNumber :
PortalSettings :
PostalCode :
Anyone got any ideas?
\\Tjopsta// http://www.tjopsta.net