PowerShell

Exchange 2013 – Delete all contents from mailbox

Using the following Exchange Management Shell command you can cleanup emails from a mailbox such as one used to catch spam emails:

You can also check the number of items in the mailbox by issues the following command:

 

How to Remove Users From the Office 365

The time may come to clean up. Here are steps I have taken

To delete the account for one or more users

  1. Sign in to Office 365 with your work or school account.
  2. Go to the Office 365 admin center.
  3. Go to Users > Active Users.
  4. Choose the names of the users that you want to delete, and then select DELETE Delete.
  5. In the confirmation box, select Yes.

Done; not so fast.  The deleted users is not fully gone yet. It takes 30 days after you have deleted the user for it to purge from Office 365.  However there is a way to do this faster

To delete, deleted users in Office 365

Connect to Exchange Online using the Windows Azure Powershell module.

To connect you enter the following cmdlet’s:

This will prompt you for your credentials and stores them within $msolcred.

Next we enter to connect using the stored credentials

Now that you are connected you can issue the following command to list deleted users

Display deleted user

To remove the deleted user

If you had multiple users, this method would work to remove all deleted users recycle bin

 

Tech Short: Convert a Mailbox, Exchange 2013

Here are some steps that worked for me in converting a user mailbox to a shared mailbox.

Info: You can convert the following mailboxes from one type to another

  • User mailbox to resource mailbox
  • Shared mailbox to user mailbox
  • Shared mailbox to resource mailbox
  • Resource mailbox to user mailbox
  • Resource mailbox to shared mailbox

Example reason why you might wan’t to do this:

You have a mailbox account with the name of  bookclub and are looking make it a shared account because its consuming a license. To address this we will convert it to a shared mailbox account by issues the following commands in the Exchange Management Shell

 

If you have multiple accounts, the following steps may apply to you

 

Please note the following csv document formatting:

Ref: http://technet.microsoft.com/en-us/library/jj710164%28v=exchg.150%29.aspx

 

Tech Short: List Mailbox Type of Account, Exchange 2013

Quick an simple power shell line to list a mailbox type in the Exchange 2013 environment

 

Additional info on RecipientTypeDetails enumeration can be located here

Tech Short: List all shared mailboxes, Exchange 2013

Quick an simple power shell line to list all shared mailboxes in your Exchange 2013 environment.

 

What’s a Shared Mailbox

A shared mailbox is a mailbox that multiple users can use to read and send email messages. Shared mailboxes can also be used to provide a common calendar, allowing multiple users to schedule and view vacation time or work shifts. ref: http://technet.microsoft.com/en-us/library/jj150498%28v=exchg.150%29.aspx

Tech Short: What is my Lync 2010 Server Version?

So you are looking to upgrade; or at best update to a CU and well the first question in your mind is; what version of Lync am I running.

This info can be obtained by the Lync Server Management Shell

 

Run the following command: Get-CsServerVersion and you now have your server version

As always, I hoped this helped

 

 

Azure Active Directory Module for Windows Powershell – How to Connect

I recently needed to use this and well; I’m learning as I go.

So one of the tasks I needed to do in O365 was to delete a user.  This required me to use Azure AD PowerShell.

Fist step was simple.  Install Windows Azure Active Directory Module for Windows PowerShell onto a system.

Next was to launch it.

Cool, I am in powershell!  But what next, how do I connect.

To connect you enter the following cmdlet’s:

which will prompt you for your credentials and stores them within $msolcred.

Next we enter

to connect using the stored credentials

That’s it.

For more info on Azure Powershell – http://azure.microsoft.com/en-us/documentation/articles/install-configure-powershell/

Related FAQs:

How can I determine what version of AAD PowerShell I have?
You can run the get-item cmdlet to check the version of the DLL files of the module that you have currently installed:

Where can I find the latest version of AAD PowerShell?

The following fwlinks should always point to the most current version of AAD PowerShell
Azure Active Directory Module for Windows PowerShell (64-bit version) This link is external to TechNet Wiki. It will open in a new window.
Azure Active Directory Module for Windows PowerShell (32-bit version) This link is external to TechNet Wiki. It will open in a new window.

SharePoint 2013: Upgrade to Claims Based Authentication

Claims-based authentication is an essential component to enable the advanced functionality of SharePoint 2013.

To move classic-mode web applications from SharePoint 2010 Products to SharePoint 2013, you can convert them to claims-based web applications within SharePoint 2010 Products, and then migrate them to SharePoint 2013.

The procedures in this post will address the issue I had faced after upgrading to SharePoint 2013 from 2010.

Due to classic mode authentication being officially depreciated by Microsoft, the database needed to be updated to claims based authentication.

During my testing; I noticed many (if not all) users accounts had issued logging into sites which worked prior to the upgrade.  I was removing and re adding them to work around this issue ; which was very tedious.

Using the Convert-SPWebApplication PowerShell command simplified this task.

Here are the steps I took

Launched SharePoint 2013 Management Shell as Administrator

Enter the following commands

Convert-SPWebApplication -Identity <URL> -To Claims -RetainPermissions

Please note the <URL> is the http://address to your SharePoint 2013 site application. Example: http://corp.jermsmit.com

For more info check out: http://technet.microsoft.com/en-us/library/gg251985.aspx

SharePoint 2010 to SharePoint 2013, Content Database Upgrade

I have been working on upgrading SharePoint 2010 to SharePoint 2013.  Here are some notes on steps taken to update a content database for your default web application.

Please note:  

  1. A backup of your default (primary) SharePoint 2010 content database is needed.
  2. These steps are for those who have already installed SharePoint and have a functioning central administration site working.

Step 1 – Backup of content database.

In order to upgrade and mount your SharePoint 2010 content database in SharePoint 2013 you will need to create a backup of the content database and restore this onto the database server chosen to server as your SharePoint 2013 database. While a new server is not required (space permitting) you may do this on the same database by restoring with a different name.

Step 2 – Create new (in my case) default application site

To attach the restored SharePoint 2010 database to the SharePoint 2013 installation, we need to create a new application site.

  • Open Central Administration
  • In Central Administration, select Application Management then select Manage Web Applications 
  • One under the Manage Web Applications, click  New to create a new web application
  • This bring you to the ‘Create New Application setup model.  There are many options here. In my case I am setting up just a new SharePoint site.
  • Create a new IIS website – For my setup I am keeping the default name. If the site runs on port 80 no need to change this. I am keeping the default site path, and being that this is part of an upgrade of a SharePoint 2010 database I am calling the database WSS_Content_delete_me as a reminded to delete later.
    Click OK and you will see the following popup
  • Followed by a message indicating that your application has been created.
  • We now want to make our way to Central Administration > Application Management and select, Manage content database 
  • Selecting the database we created above: ‘WSS_Content_delete_me’ we choose the option to remove the content database from the newly created application
  •  Click ‘ok’ to complete this action

Step 3 – Upgrade and Mount (attach) Database

The next steps require us to use SharePoint 2013’s Management Shell to mount the SharePoint 2010 database and in doing so upgrade it to function with SharePoint 2013.

We run the following command syntax to mount  the database:

To mount: Mount-SPContentDatabase -Name <database_name> -WebApplication http://<sharepoint_server_application>

To test: Test-SPContentDatabase -Name <database_name> -WebApplication http://<sharepoint_server_application>

Depending on the size of the content database, you may have to wait for a short period of time for the upgrade to complete.

* note * you may encounter error messages at the end of the upgrade once completed indicating customization’s that are not supported in SharePoint 2013.

street slang: cmdlet

A cmdlet (pronounced “command-let”) is a lightweight Windows PowerShell script that performs a single function. A cmdlet, which is expressed as a verb-noun pair, has a .ps1 extension.

Windows PowerShell has over two hundred basic core cmdlets and had been extended to 1000’s due to administrators writing their own.

Each cmdlet will have a help file that can be accessed by typing Get-Help “cmdlet name”. All this and more are in PowerShell so have a look.

More info on PowerShell can be found here: http://technet.microsoft.com/en-us/library/bb978526.aspx