sonofsanta Posted March 21, 2014 Posted March 21, 2014 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.
Boredguy Posted March 21, 2014 Posted March 21, 2014 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 SMTP:[email protected] smtp:[email protected]) 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.
Edu-IT Posted March 21, 2014 Posted March 21, 2014 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.
Paid_Peanuts Posted May 22, 2014 Posted May 22, 2014 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.InvalidUserLicenseOptionException,Microsoft.Online.Administration.Automatio n.SetUserLicense Any ideas - this is driving me nuts!
themightymrp Posted May 22, 2014 Posted May 22, 2014 OK, to define your student licenses (assuming you ONLY want email) use: $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: get-msoluser -all | where-object {(-not $_.islicensed) -and ($_.department -eq "Student")} | set-msoluserlicense –addlicenses “SchoolName:STANDARDWOFFPACK_STUDENT” Then trim your licenses using: get-msoluser -all | where-object {($_.islicensed -eq "True") -and ($_.department -eq "Student")}| set-msoluserlicense –licenseoptions $nostustuff 1
Boredguy Posted May 22, 2014 Posted May 22, 2014 We set the license in a single pass So for students that only get an exchange license it's $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" } } 1
Sam_Brown Posted May 27, 2014 Posted May 27, 2014 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!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now