Wednesday, October 19, 2011

BPOS PowerShell Commands

Grant full access, send as, and send of behalf of  permission to account.


Add-MSOnlineMailPermission -GrantFullAccess True -GrantSendAs True -GrantSendOnBehalfOf True -Identity User1@domain.com -TrustedUser User2@domain.com

 Grants User2@domain.com access to User1@domain.com account.

Tuesday, October 11, 2011

Office 365 PowerShell commands

As I come across useful Powershell commands to manage Office365 I'll add them here.

To manage Office 365 through PowerShell you first need to install an update to PowerShell that can be found HERE

List of  commands


1.    Authenticate with Office 365

 Connect-MsolService


2.   Get list of user accounts

Get-MSOLUser

3.   Change password to never expire.

Set-MsolUser -UserPrincipalName     -PasswordNeverExpires $true


-----------------------------------------

Connect Windows PowerShell to the Service


Applies to: Office 365 for professionals and small businesses, Office 365 for enterprises, Live@edu
Topic Last Modified: 2011-12-19
After you have installed and configured Windows PowerShell and Windows Remote Management (WinRM) on your computer, you have to connect the Windows PowerShell on your local computer to the cloud-based service to perform tasks in your cloud-based organization.
When you open Windows PowerShell on your computer, you're in the Windows PowerShell session of your local computer. A session is an instance of Windows PowerShell that contains all the commands that are available to you.
The Windows PowerShell session of your local computer, called the client-side session, only has the basic Windows PowerShell commands available to it. By connecting to the cloud-based service, you connect to the Microsoft datacenter's server environment, called the server-side session, which contains the commands used in the cloud-based service.

Before you begin

Before you connect, make sure you have the correct version of Windows PowerShell and WinRM installed and configured on your computer. For more information, see Install and Configure Windows PowerShell.
Verify the account you will use to connect is authorized to connect using Windows PowerShell. For more information, see Control Users' Access to Windows Remote Management.

Connect Windows PowerShell on your local computer to the cloud-based service

  1. Click Start > All Programs > Accessories > Windows PowerShell > Windows PowerShell.
  2. Run the following command:

    $LiveCred = Get-Credential
    
  3. In the Windows PowerShell Credential Request window that opens, type the credentials of an account in your cloud-based organization. When you are finished, click OK.
  4. Run the following command:

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
    
    Note   The AllowRedirection parameter enables cloud-based organizations in datacenters all over the world to connect Windows PowerShell to the cloud-based service by using the same URL.
  5. Run the following command:

    Import-PSSession $Session
    
    A progress indicator appears that shows the importing of commands used in the cloud-based service into the client-side session of your local computer. When this process is complete, you can run these commands.

Disconnect Windows PowerShell from the cloud-based service

When you're finished using the server-side session, always disconnect Windows PowerShell by running the following command:

Remove-PSSession 
For example, to disconnect from the server-side session that is defined by the $Session variable, run the following command:

Remove-PSSession $Session
Important   If you close the Windows PowerShell window without disconnecting from the server-side session, your connection will remain open for 15 minutes. Your account can only have three connections to the server-side session at one time.

----------------------------------------------------------------


Give an Administrator the Ability to Open and View the Contents of a User's Mailbox


Applies to: Office 365 for professionals and small businesses, Office 365 for enterprises, Live@edu
Topic Last Modified: 2011-03-08
Your organization may require that Exchange Online administrators be able to open another user's mailbox and view the contents, including reading e-mail messages.
By default, Exchange Online administrators or members of the Organization Management administrator role group can access a user's Options page in the Exchange Control Panel, but they can’t open the user’s mailbox and view the contents. You have to explicitly assign an administrator the permissions necessary to open another user's mailbox.

Assign permissions to one Exchange Online administrator

Run the following command:

Add-MailboxPermission  -User admin -AccessRights FullAccess -InheritanceType All
Note   You can also allow an ordinary user, such as an administrative assistant or human resources specialist, to open another user's mailbox by specifying that person in the User parameter.

Assign permissions to the Organization Management role group

Run the following command:

Add-MailboxPermission  -User "Organization Management" -AccessRights FullAccess -InheritanceType All

Give full access to all user mailboxes in your organization

To give the Exchange Online administrator access to all user mailboxes in your organization, run the following command:

Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox') -and (Alias -ne 'Admin')} | Add-MailboxPermission -User admin -AccessRights fullaccess -InheritanceType all
To give members of the Organization Management role group access to all user mailboxes, set the User parameter to “Organization Management” in the previous command.

Open another user's mailbox

Here's how you open another user's mailbox after you've been assigned permissions: Open Another Mailbox.


Friday, October 7, 2011

Export / Merge recovered mailbox from RSG to a new account

Exchange 2007 Recovery Storage Group

Export / Merge recovered mailbox from RSG to a new account


Restore-Mailbox –RSGMailbox “Test User 1” -RSGDatabase “servername\RSG name\database name” –Identity “Test User 2” –TargetFolder “Test User 1 Recovered data”