Archive

Posts Tagged ‘Office365’

Get a list of Office365 users with License attached, Primary SMTP address and Aliases


To get an list of all users that has an Office365 license assigned and with Displayname, Primary SMTP address and all other adresses registrated on the users use this one-liner in PowerShell! 🙂

get-mailbox | Where-Object {$_.SKUAssigned -eq “TRUE”} | Select-Object Displayname, PrimarySMTPAddress, EmailAddresses | Export-Csv c:\temp\noah2.csv -Encoding UTF8

Finding Exchange Control Pane in Office 365 with new layout


Lately Microsoft have changed its layout in Office365 and in that same change made it harder to find Exchange Control (ECP) Panel.

At the moment the easiest way to open ECP is to log in to your office 365 Outlook Web Access.
Then, change the url from something like this: https://pod51049.outlook.com/owa/ to this: https://pod51049.outlook.com/ecp/

As you can see you change OWA to ECP and youre in!

Change primary email address in Office 365


Start powershell as administrator

Run the following commands:
$LiveCred = Get-Credential
(Enter your Office 365 administrator credentials)
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session

Find all aliases for one account:
get-mailbox | select -expand emailaddresses alias
Alternativt:
get-mailbox name@domain.com | select -expand emailaddresses alias

Add email alias to an Account:
Set-Mailbox name@domain.com -EmailAddresses SMTP:newprimaryaddress@domain.com,anotheraddress@domain.com,yet.another.address@domain.com

NOTE: the first address after “SMTP:” will be the primary e-mail address. All aliases will be replaced. If you have 100 aliases and only type in one in this command, you will lose 99 aliases!

Set passwords to never expire in office 365


First, Enable .net 3.5 on your system.

Then, Download and Install Microsoft Online Services Sign-In Assistant

Microsoft Online Services Sign-In Assistant 64-bit (BETA) – <a title=”Microsoft Online Services Sign-In Assistant 64-bit (BETA) – http://www.microsoft.com/en-my/download/details.aspx?id=39267

Then Download and install Microsoft Online Services Module for Windows PowerShell

Microsoft Online Services Module for Windows PowerShell 64-bit – http://g.microsoftonline.com/0BX10EN/423

Restart computer and start “Microsoft Online Services Module for Windows PowerShell”

Type the command:  Connect-MsolService

And in the dialog enter the credentials of your Office 365 administrator

To control if a password for a single user expires
Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires

To change the password policy to never expire for a single user
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $true

To change the password policy to never expire for all users at once
Type the command: Get-MsolUser | Set-MsolUser -PasswordNeverExpires $True

To control that the modifications have been applied
Type the command “Get-MsolUser | fl”

And if you need to apply password policy to users

To change the password policy to expire for a single user
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $false

To change the password policy to expire for all users at once
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $false

%d bloggers like this: