0 votes

Hi team,

what is the best approach to create a room mailbox for a MS Teams Room?

I created a "create user action", and assign a Team Pro Licnese to this user. However this will not trigger creation of a mailbox (we using hybrid exchange).

How do we enforce mailbox creation? Do we need to assign E3 license and revoke this later? Or would "create mailbox" action help and later move this to online?

by (1.1k points)

1 Answer

0 votes
by (271k points)

Hello,

Sorry for the confusion, but we are not sure what exactly you need to achieve.

If it is about creating a room mailbox in Exchange Online, you can use the Enable-Mailbox cmdlet with the corresponding parameters. For details on how to connect to Exchange Online in Adaxes scripts, see https://www.adaxes.com/script-repository/connect-to-exchange-with-powershell-s506.htm.

If you need a remote room mailbox, you can use script Room remote mailbox from the following article in our repository: https://www.adaxes.com/script-repository/create-remote-mailbox-s256.htm. For more details on the method used in the script, see https://adaxes.com/sdk/IAdmExchangeRemoteMailboxOps/#EnableRemoteMailboxEx_details.

Either of the scripts should be executed in a business rule triggering After creating a user.

0

Oh wow, how can I thank you for this? <3 tiny but big impacted issue ... doing a test currently and looking good so far

0

Two more questions about this issue

  1. Why is even adm-CustomAttributeObject1 not set? This value is not modified during Powershell Script
  2. Is it possible to improve warning level like above and add a line number for better reference?
0

Hello,

Why is even adm-CustomAttributeObject1 not set? This value is not modified during Powershell Script

As per our tests it worked fine. Please, provide us with a screenshot of the corresponding execution log.

Also, we fixed some coding mistakes in your script. Give the below version a try. It will probably give you more details insight on the actual issue.

. "\\xxxxx\xxxx\xxx\functions.ps1"

## Firstname
$firstname = "%adm-CustomAttributeObject1:format[name],2% Room Mailbox"
$Context.LogMessage("Firstname will be set to: " + $firstname, "Information") 

# Update User First Name
$Context.SetModifiedPropertyValue("givenName", $firstname)

## Lastname
$lastname = ReplaceCharacters("%displayName%")
$Context.LogMessage("Lastname will be set to: " + $lastname, "Information") 

# Update User Last Name
$Context.SetModifiedPropertyValue("sn", $lastname)

## CN
$Context.LogMessage("CN will be set to: " + $firstname + " " + $lastName, "Information") 

# Update User CN
$Context.SetModifiedPropertyValue("cn", $firstname + " " + $lastname)

## Display Name
$displayNamePrefix = "%adm-CustomAttributeObject1:format[name]%"
$displayNamePrefix = $displayNamePrefix.Replace("_"," ")
$Context.LogMessage("Displayname will be set to: $($displayNamePrefix) %displayName%", "Information") 

# Update User Display Name
$Context.SetModifiedPropertyValue("displayname", $displayNamePrefix + "%displayName%")        

## Username
# Get the username
$username = "%username%"
$Context.LogMessage("Username checking: " + $username, "Information")

# Replace special characters in username
$username = generateSamaccountnameMailbox -mailboxLocation "%adm-CustomAttributeObject1:format[name],2%" -mailboxDisplayname "%displayName%"
$Context.LogMessage("Username updated: " + $username, "Information")

# Update User Logon Name (pre-Windows 2000)
$Context.SetModifiedPropertyValue("samAccountName", $username)
$Context.LogMessage("User Logon Name (pre-Windows 2000): $username", "Information")

# Get domain name
$domainName = "xyz.com"

# Update User Logon Name
$Context.SetModifiedPropertyValue("userPrincipalName", "$username@$domainName")
$Context.LogMessage("User Logon Name: $username@$domainName", "Information")

## Email
# Get the email address
$mail = "%mail%"

# Check if email is set in form
if($mail)
{
    $Context.LogMessage("Mail checking: " + $mail, "Information")
    # Check if mail is unique
    $uniqueEmail = IsEmailAddressUnique -emailaddress $mail

    if($uniqueEmail -eq $true)
    {
        $Context.LogMessage("Mail is unique and can be used", "Information")
        $Context.SetModifiedPropertyValue("adm-CustomAttributeText3", $newMail)
    }
    else
    {
        $newMail = generateEmailaddress -emailaddress $mail
        $Context.LogMessage("Mail is NOT unique and can NOT be used", "Warning")
        $Context.LogMessage("New Email Address: " + $newMail, "Information")
        $Context.SetModifiedPropertyValue("adm-CustomAttributeText3", $newMail)
    }        
}
else
{
    # No email provided, will generate one
    $email = $username + "@" + $domainName
    $newMail = generateEmailaddress -emailaddress $email
    $Context.LogMessage("Mail not provided, will generate one", "Information")
    $Context.LogMessage("New Email Address: " + $newMail, "Information")

    # Update User Mail
    $Context.SetModifiedPropertyValue("adm-CustomAttributeText3", $newMail)
}

Is it possible to improve warning level like above and add a line number for better reference?

Unfortunately, there is no such possibility.

0

Ok thanks,

Would it be possible, to outsource my script above to a custom command? So instead of executing PS code before creating a user, I would like to execute a command, and this command contains the PS code.

Why?

I would like to maintain only 1 command/PS code for several object types. I would send over a paramater like room or shared mailbox to the custom command to differentiate this.

My first try shows me nothing for %mail% or %firstname%

0

Hello,

Unfortunately, there is no such possibility. The SetModifiedPropertyValue method used in the script can only be executed in business rules triggering before an operation. It will never work in a custom command.

Related questions

0 votes
1 answer

Hi team, how can we show and edit account options for object types of "Room mailboxes". If we add "account options", there is nothing to add: How can we set for example password never expires or user can't change password?

asked Nov 29, 2023 by wintec01 (1.1k points)
0 votes
1 answer

It appears that we can allow conflicting meetings on a room mailbox but can't set the number of allowed conflicts. Is this a bug or intended? Can we request this feature? Do ... to create a custom command for this? We are on version 3.14.19723.0 Thanks, Mark

asked Jul 13, 2022 by mark.it.admin (2.3k points)
0 votes
0 answers

Hey Guys We have some issues with new meeting rooms that we have created. Previously we used to have on-premise exchange but switched to office365. Before doing ... OU but the interface are different. under exchange properties they are different aswell.

asked Sep 18, 2019 by seanr (70 points)
0 votes
1 answer

Hello, I have a sheduled task running. This task checks if a user is a member of a Licensed Office 365 Group with exchange online. If the user does not have an ... the on prem exchange mailbox and the exchange online mailbox? Thanks if you have an idea!

asked Feb 24, 2023 by fabian.p (150 points)
0 votes
0 answers

When attempting to assign licenses during the "after creating a user" rule we're reciving the following error. Failed to create a remote mailbox for the user. The address ' ... mail attribute to the proper format that isn't the onmicrosoft.com domain as well.

asked Sep 2, 2021 by zorps (20 points)
3,339 questions
3,040 answers
7,758 comments
544,916 users