PowerShell

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

Windows 8: fixing trust relationship issues

Dear Jermal, here is some info that you may find useful in the future. I hope that you share with your friends, coworkers and the readers of your blog.

From time to time I have found myself having to reset the computer account of a workstation that was left offline. In most cases this workstation was a virtual machine with a computer password that expired. A clear sign of this is the message “The trust relationship between this workstation and the primary domain failed.” 

This can be fixed by classic steps of removing the computer from the domain and then joining it back. You could also attempt to log into active directory users and computers and reset the computer object; I haven’t had much success with this. Perhaps I’m to impatient to wait for replication.

Another method is to use PowerShell and the Test-ComputerSecureChannel method.

By loading up PowerShell (as Administrator) you can run the Test-ComputerSecureChannel cmdlet (pronounced “command-let”). Running this command on a working machine will return the value of “True”

If the Test-ComputerSecureChannel cmdlet returns False, use the Repair switch to repair the secure channel. That command will look like this: “Test-ComputerSecureChannel

I hope this helps,

Sincerely,

Jermal

 

P.S. – You will need to be logged in under a cached Administrator account on the computer; To do this you just remove yourself from the network and log in under your credentials.

 

Exchange 2013: Migrating Mailboxes via PowerShell

Exchange 2013 has new and impressive administration center that allows you to handle tasks such as mailbox moves. I prefer using the Exchange Management Shell for such a task.

Using the following command you can move all mailboxes within a database to your new mailbox database: Get-Mailbox -Database “Source-Database” | New-MoveRequest -TargetDatabase “Destination-Database”

To get info on the migration progress you can use the following command syntax: Get-MoveRequestStatistics -MoveRequestQueue “Destination-Database”

Once this migration has completed you can check if anything exists in the source database with the following: Get-MailboxDatabase -Identity “Source-Database” | Get-Mailbox

Exchange 2013: Get Mailbox Move Request Statistics

After some weekend Exchange mailbox migrations I wanted to check the status of mailboxes. This is where I use the Get-MoveRequestStatistics for the all mailboxes or database.

Issuing the following command: Get-MoveRequestStatistics -MoveRequestQueue “*databasename*” will return to you the status of all the mailboxes on that data store. This is good; but what if you are only interested in the status of the databases that are currently being migrated over.

Issuing the following command seems to do the trick:
Get-MoveRequest | where {$_.status -ne ”Completed”} | Get-MoveRequestStatistics

As you see above we used the ‘where’ clause to select all of the database moves that are not in a “Completed” status.

Another command I found useful is used to show if mailboxes exist within a particular database, which is very useful when migrating mailboxes and validating if they old database is now free of mailboxes.

The command I use is: Get-MailboxDatabase -Identity “OLDSTORE1” | Get-Mailbox

PowerShell: Set Network Profile

Looking to change the network profile of my public facing adapter from Public to Private I recently found out I can use the PowerShell command Get-NetConnectionProfile to return the the connection profile associated with one or more physical network adapters.

Once I have this information I can then modify the NetworkCategory to what I wish by using the Set-NetConnectionProfile command.

Example: Set-NetConnectionProfile -InterfaceIndex 13 -NetworkCategory Private 

How awesome is that

Resources: http://technet.microsoft.com/en-us/library/jj899566.aspx

Resources: http://technet.microsoft.com/en-us/library/jj899565.aspx

 

PowerShell: Get basic network adapter properties

Get-NetAdapter cmdlet returns to you the basic network adapter properties of visible adapters installed on your system. This is a very useful tool to gather some details about your installed network adapters.

More info and features can be found here: http://technet.microsoft.com/en-us/library/jj130867.aspx

 

Pre-Requisites Time – Coming Soon

I open PowerShell as Administrator and type the following:

Install-WindowsFeature AS-HTTP-Activation, Desktop-Experience, NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, Web-Mgmt-Console, WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth, Web-Client-Auth, Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression, Web-Http-Errors, Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Lgcy-Mgmt-Console, Web-Metabase, Web-Mgmt-Console, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor, Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth, Web-WMI, Windows-Identity-Foundation

followed by pressing enter…

what next you ask?  Well stop by later and find out.

SharePoint 2010 – Updating Webpart Solution

Similar to my previous post SharePoint 2010 – Deploying Webpart Solution, the upgrade process of a Webpart Solution you have a few steps to take to make this all happen.

As I did in my previous post:

I copied the webpart to the local disk of my SharePoint 2010 server. Placing it in a folder c:install this time around I am not going to be running the command Add-SPSolution c:installSharePointWebpart.wsp as it already exist. If you do you will get an error stating that the solution already exists.

What you will need to do is run the following command for example: Update-SPSolution –Identity SharePointWebpart.wsp –LiteralPath c:installSharePointWebpart.wsp –GACDeployment

For more info on features and solutions cmdlets: http://technet.microsoft.com/en-us/library/ff607724.aspx

SharePoint 2010 – Deploying Webpart Solution

The process of installing a custom webpart solution doesn’t have to be a complex task. In fact all you need to do is run two commands In Power Shell and activate the custom webpart and you are done.

So here are some steps I took recently:
Copied the webpart to the local disk of my SharePoint server, I placed this file in c:install
Add-SPSolution c:installSharePointWebpart.wsp
Install-SPSolution –Identity SharePointWebpart.wsp –WebApplication http://somesite –GACDeployment

After the install of the w webpart you will need to do the following to make it active.
I navigated to the site where my new webpart solution was deployed: http://somesite
Then clicked on Site Action followed by Site Settings
Under Site Collection Administration I then entered Site Collection Features
Under Site Collection Administration > Features I located the webpart and clicked activate

Now the web part is available for use.

I hope this helps