+ Post New Thread
Page 4 of 4 FirstFirst 1234
Results 46 to 57 of 57
Cloud Services Thread, Office 365 questions in Technical; Due to our setup, I was hoping there was a way to do it directly on Office365 through Powershell rather ...
  1. #46

    Edu-IT's Avatar
    Join Date
    Nov 2007
    Posts
    7,161
    Thank Post
    403
    Thanked 623 Times in 569 Posts
    Rep Power
    181
    Due to our setup, I was hoping there was a way to do it directly on Office365 through Powershell rather than our own AD. I want to create the new primary SMTP address on Office 365. I am a little confused about what you've posted will do in that regard?

  2. #47

    sonofsanta's Avatar
    Join Date
    Dec 2009
    Location
    Lincolnshire, UK
    Posts
    5,003
    Thank Post
    874
    Thanked 1,458 Times in 1,002 Posts
    Blog Entries
    47
    Rep Power
    644
    Set-MsolUser (in Windows Azure AD) has the -AlternateEmailAddress flag, you could probably do something with that (and using the .replace() to work out what you're adding). Can't see anything for changing the primary email there - perhaps you just need to change -UserPrincipalName to do it? You'd need to make sure your onsite AD matches, though.

    That script above read in username and email address for a list of users, worked out what the new email address would be based on a domain swap, set that as the primary email address and added the original email (as read from the CSV) as a proxyAddress, which is the AD attribute containing all the alternate email addresses for a user. Runs on local AD because that's how I do it here and as I didn't know you needed it to work specifically on Office 365. You should be able to adapt it using Set-MsolUser.

    You might have to do it by connecting to the remote Exchange, acually - use Set-Mailbox -EmailAddresses, e.g.
    Code:
    Set-Mailbox kakers@contoso.com -EmailAddresses SMTP:kim.akers@contoso.com,kakers@contoso.com,kakers@contoso.net,kakers@contoso.org
    Could build up the list of email addresses with the .replace as above.

  3. #48

    Edu-IT's Avatar
    Join Date
    Nov 2007
    Posts
    7,161
    Thank Post
    403
    Thanked 623 Times in 569 Posts
    Rep Power
    181
    @edu-tech Any advice on changing the primary SMTP?

  4. #49

    sonofsanta's Avatar
    Join Date
    Dec 2009
    Location
    Lincolnshire, UK
    Posts
    5,003
    Thank Post
    874
    Thanked 1,458 Times in 1,002 Posts
    Blog Entries
    47
    Rep Power
    644
    Quote Originally Posted by Edu-IT View Post
    @edu-tech Any advice on changing the primary SMTP?
    FWIW, that Set-Mailbox command sets the first email in the list as primary (e.g. kim.akers@contoso.com) and the others as alternates.

    You can run Exchange commands on Office 365 directly by opening Powershell and running
    Code:
    Set-ExecutionPolicy RemoteSigned
    $LiveCred = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
    Import-PSSession $Session

  5. #50

    Edu-IT's Avatar
    Join Date
    Nov 2007
    Posts
    7,161
    Thank Post
    403
    Thanked 623 Times in 569 Posts
    Rep Power
    181
    Ah, I see, thank you. Appreciate help. :-)

  6. #51

    sonofsanta's Avatar
    Join Date
    Dec 2009
    Location
    Lincolnshire, UK
    Posts
    5,003
    Thank Post
    874
    Thanked 1,458 Times in 1,002 Posts
    Blog Entries
    47
    Rep Power
    644
    Quote Originally Posted by Edu-IT View Post
    Ah, I see, thank you. Appreciate help. :-)
    np. Stick those 4 lines at the start of a .ps1 file, follow with whatever code you need to generate the emails as variables and loop through everyone, then you can just run that file in PowerShell, give it your 365 credentials and off you go.

  7. #52
    Boredguy's Avatar
    Join Date
    Jun 2011
    Location
    Swindon
    Posts
    600
    Thank Post
    4
    Thanked 133 Times in 124 Posts
    Rep Power
    50
    Quote Originally Posted by Edu-IT View Post
    Due to our setup, I was hoping there was a way to do it directly on Office365 through Powershell rather than our own AD. I want to create the new primary SMTP address on Office 365. I am a little confused about what you've posted will do in that regard?
    I'm slightly confused (nothing new there) on what your wanting to do with the e-mail address.

    For Office365 it uses the mail attribute along with the UPN suffix to create your users logon accounts and e-mail addresses if Exchange license is added.
    It will use the proxyAddress field if you want your user to have an alias, with the SMTP value in capitals as the primary address, and smtp in lowercase as the alternative address (ie SMTPrimaryaddress@blah.com smtp:altaddress@blah.com)

    Any account that is synchronised with your Active Directory only has limited options that can be altered in the 365 powershell environment

    Unsyncronised accounts can have multiple addresses added via the example @sonofsanta has posted
    All accounts regardless of creation method will have the @Tenancy.onmicrosoft.com address assigned as alias regardless of the accounts primary domain assignment.

  8. #53

    Edu-IT's Avatar
    Join Date
    Nov 2007
    Posts
    7,161
    Thank Post
    403
    Thanked 623 Times in 569 Posts
    Rep Power
    181
    We don't use DirSync or ADFS. Our tenant's primary domain is something.com, although we still actively use something.something.sch.uk. So I want to add in something.something.sch.uk as an additional SMTP address and set that as a primary SMTP. I am having to do a lot of stuff manually as I am migrating users over bit by bit right now so still running an onsite exchange using something.something.sch.uk, hence why we setup something.com so we could get the Office 365 tenant setup and test. When I move in a bulk of users I don't want to have to do it manually as much.

  9. #54
    Paid_Peanuts's Avatar
    Join Date
    Jun 2007
    Location
    South Yorkshire
    Posts
    232
    Thank Post
    11
    Thanked 13 Times in 12 Posts
    Rep Power
    17
    Microsoft love to make things easy don't they!

    I am running the latest Azure Active Directory module, it is running as Administrator direct from our Directory Sync server.

    OK so I have checked our AccountSkuId and we have relevant licenses in place and enough of them.

    I have run the following command which completed successfully: Get-MsolUser -All | Set-MsolUser -UsageLocation "GB"

    I then run: $nostustuff =new-msollicenseoptions –accountskuid SchoolName:STANDARDWOFFPACK_STUDENT
    I follow that up with: get-msoluser -all | where-object {($_.islicensed -ne "True") -and ($_.department -eq "Student")}| set-msoluserlicense –licenseoptions $nostustuff
    I have populated the Department filed within AD with Student and made sure a successful synchronization has completed.

    Powershell then returns the following:
    Set-MsolUserLicense : Unable to assign this license because the license options are invalid.
    At line:1 char:118
    + get-msoluser -all | where-object {($_.islicensed -ne "True") -and ($_.department -eq "Student")}| set-msoluserlicense <<<< -licenseoptions $nostus
    tuff
    + CategoryInfo : OperationStopped: ( [Set-MsolUserLicense], MicrosoftOnlineException
    + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.Invalid UserLicenseOptionException,Microsoft.Online.Admini stration.Automatio
    n.SetUserLicense


    Any ideas - this is driving me nuts!

  10. #55
    themightymrp's Avatar
    Join Date
    Dec 2009
    Location
    Leeds, West Yorkshire
    Posts
    1,220
    Thank Post
    216
    Thanked 226 Times in 195 Posts
    Rep Power
    73
    OK, to define your student licenses (assuming you ONLY want email) use:

    Code:
    $nostustuff = new-msollicenseoptions –accountskuid SchoolName:STANDARDWOFFPACK_STUDENT –disabledplans SHAREPOINTWAC_EDU,SHAREPOINTSTANDARD_EDU,MCOSTANDARD


    I can't remember if this is right or not but I assigned full licenses to users THEN went back and changed the to remove the bits I didn't want.

    So to assign full license:

    Code:
     get-msoluser -all | where-object {(-not $_.islicensed) -and ($_.department -eq "Student")} | set-msoluserlicense –addlicenses “SchoolName:STANDARDWOFFPACK_STUDENT”
    Then trim your licenses using:

    Code:
     get-msoluser -all | where-object {($_.islicensed -eq "True") -and ($_.department -eq "Student")}| set-msoluserlicense –licenseoptions $nostustuff

  11. Thanks to themightymrp from:

    Paid_Peanuts (22nd May 2014)

  12. #56
    Boredguy's Avatar
    Join Date
    Jun 2011
    Location
    Swindon
    Posts
    600
    Thank Post
    4
    Thanked 133 Times in 124 Posts
    Rep Power
    50
    We set the license in a single pass

    So for students that only get an exchange license it's
    Code:
    $LicOptions = New-MsolLicenseOptions -AccountSkuId school:STANDARDWOFFPACK_STUDENT -DisabledPlans MCOSTANDARD, SHAREPOINTWAC_EDU, SHAREPOINTSTANDARD_EDU
    $users = Get-MsolUser -UnlicensedUsersOnly -Synchronized -MaxResults UnLimited | Where-Object {$_.department -eq "Student" }
    if (($users)){
    foreach ($user in $users) {
    #Set location
    Set-MsolUser -UserPrincipalName $user.UserPrincipalName -UsageLocation GB
    #Set Office 365 License
    Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -AddLicenses "school:STANDARDWOFFPACK_STUDENT" -LicenseOptions $LicOptions
    #Set ProPlus licence
    Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -AddLicenses "school:OFFICESUBSCRIPTION_STUDENT"
    }
    }

  13. Thanks to Boredguy from:

    Paid_Peanuts (22nd May 2014)

  14. #57
    Sam_Brown's Avatar
    Join Date
    Sep 2009
    Location
    Northampton
    Posts
    574
    Thank Post
    97
    Thanked 40 Times in 38 Posts
    Rep Power
    18
    This is a great topic and full of good advice and tips. Wish I'd have found it a few weeks ago when I was doing our initial O365 configuration. Like someone near the beginning said a lot of people seem to be recreating the wheel when it comes to things like this since PS came out. And while there are a lot of good scripts already on-line I always find myself having more trouble trying to work out what they do and making sure they are safe and not going to screw anything up (call me paranoid) that sometimes I can see the benefit in creating them yourself as at least you are learning how it all works at the same time!

SHARE:
+ Post New Thread
Page 4 of 4 FirstFirst 1234

Similar Threads

  1. Office 365 questions / advice needed
    By tj2419 in forum Cloud Services
    Replies: 1
    Last Post: 1st November 2012, 04:40 PM
  2. Office 365 Question
    By FN-GM in forum Cloud Services
    Replies: 8
    Last Post: 4th June 2012, 04:43 PM
  3. General Office 365 Questions, Help please!
    By AndyCan in forum Cloud Services
    Replies: 0
    Last Post: 22nd May 2012, 05:14 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •