Copy Files with metadata to SharePoint Online with PowerShell

I finally created something I felt worthy of blogging. 🙂

From talking to customers I know that a current challenge is migrating Files and File Shares to SharePoint Online. Sure uploading a bunch of content from the browser is doable but what if you want to keep the Created By, Created Date, and Modified Date as you upload that content? Well, thanks to the PNP PowerShell and a little elbow grease I have solved the puzzle. The long story short here is the PowerShell:

Get-ChildItem '\\DESKTOP-3Q38SP3\demo' |  Where-object {$_.PSIsContainer -ne $True}  | ForEach-Object {
	$own = $_.GetAccessControl().owner;
	$who = get-pnpuser | Where-Object{$_.LoginName -match "$own"} | select id;
	Add-PnPFile -Path $_.FullName -folder FileShare -Values @{Author=$;Editor=$;Created=$_.CreationTimeUtc; Modified=$_.LastWriteTimeUtc;}

For most people, just the code isn’t enough context which is fair. But instead of typing a 2000 word essay I made a video that breaks that down into baby steps and shows you how to use and things to look out for. You can watch the video Upload files to SharePoint Online with Metadata to get all of the details. I have found videos to be the most effective way to teach this crazy stuff.

Also, if you just need to solve the problem and you are looking for awesomeness then check out this function I wrote to do it all for you in one fell swoop.

To see it in action check out Copy File Share to SharePoint Online

I hope this all helps you out.

Shane @shanescows


My Articles on

Howdy – So while I have neglected the blog for the last month I can say I have not neglected writing. Quite the opposite. I have been working with the fine folks at to write some content for them. In no way does the mean I am abandoning this blog just that is my reason for the neglect for the last month. 🙂 And while we are talking about neglect my YouTube channel has also been neglected because my mic broke. Supposedly the new one is in the mail. I am not holding my breath, though.

If you are looking for some reading, check out.

The next one up that will publish later this week is PowerShell for SharePoint online. Lots of fun.


I am teaching again

I love teaching. I have often said that if everything in life paid the same, I would be a High School teacher and coach the volleyball team. But, since that isn’t how things work I have found a better outlet for my desires to teach. SharePoint classes.

As many of you know, I have been teaching SharePoint Administrators all over the world since 2004. Wow, I think that makes me really old at this point. 🙂 But over those years I have easily taught 10,000+ people the fun that is SharePoint.

So it is high time I get off my butt and return to the classroom. And to prove I am not old I am going to embrace that fancy internet thing and teach the class live, online. Recorded demos are for wimps.

The class will be ten sessions the week of Dec 5, 2016, and will also include six hands-on labs that are written to be run in your own environment, not a pre-made fantasy VM. That way you can use them for as long as you want, not just for a week.

If you are interested, please take a look at the class site SharePoint Administrator Training. It includes a detailed breakdown of the schedule, the modules, and hands-on labs. Also, as a thank you, you can get a 17% discount for the course by using the code “Blog” at checkout.



Installing and configuring PowerShell cmdlets for SharePoint Online and Office 365

I will admit it; I put this off for as long as I could. Why? Because I just wasn’t really sure what went into getting connected to my O365 subscription and I knew that there wasn’t a lot of cmdlets there. Good news I have solved both of these problems for you. The following will get you up and running with O365, Exchange Online, Skype for Business Online (Lync Online) and SharePoint Online.

If you like words, then keep reading. If you would rather me show you then you can watch my step-by-step video: Installing and Configuring PowerShell for Office 365 and SharePoint Online. The choice is yours.

Also, Microsoft does have a website that covers getting started with PowerShell. You can find most of this stuff written there, just not with my fun comments along the way.

Making sure you are ready

  1. You need to have local administrator access to install the following items.
  2. Your PowerShell execution policy needs to allow remote scripts
    1. Open PowerShell by right-clicking and running as administrator.
    2. Get-ExecutionPolicy will tell you what you currently have. Restricted will not work.
    3. Get-ExecutionPolicy
    4. If you are Restricted, then you will have to lower your policy. I recommend the following.
    5. Set-ExecutionPolicy RemoteSigned
  3. You need to be an O365 administrator to run all of the cmdlets.

The things  you need to install

There are four pieces that you need to install. And the good news is they are all next, next, finish. 🙂 Only decision you need to make is do you want the 32bit or 64bit versions. The good news is the 32bit stuff is deprecated so I am 99% sure you want the 64bit.

  1. Sign-on Assistant
  2. The Subscription management pieces
  3. SharePoint Online pieces
  4. Skype for Business Online pieces

That is all of the installing you need to do.

Getting connected

It would be rather rude if I didn’t help you also get logged in since that is probably a little more confusing than the next, next, finish of above. Remember you don’t have to connect to everything, every time. If you just need to create a Site Collection, then you can just do steps 1, 2, & 5. Also, a reminder I do a MUCH BETTER job explaining this stuff in the video.

  1. Open PowerShell as an administrator
  2. Set a variable with your credentials. That way you don’t have to keep typing in that long and secure(?) username and password.
    $credential = get-credential
  3. Connect to the Management of O365
    1. Import-Module MSOnline
    2. Connect-MsolService -Credential $credential
  4. Connect to Skype for Business Online (aka Lync Online). For these cmdlets, you are using PowerShell Remoting and running the cmdlets against the server in the cloud. So make sure when you are done you kill your session. If not you can lock out yourself or others until the sessions expire.
    1. Import-Module LyncOnlineConnector
    2. $lyncSession = New-CsOnlineSession -Credential $credential
    3. Import-PSSession $lyncSession

      Use the following to remove your session when you are done working with Skype.

    4. Remove-PSSession $lyncSession
  5. Connect to SharePoint Online (If you find these cmdlets lacking, and you will, then check out the Patterns and Practices cmdlets for some real power.)
    1. Import-Module Microsoft.Online.Sharepoint.PowerShell
    2. Connect-SPOService -url -Credential $credential
  6. Connect to Exchange Online. Like Skype, this is also a remote session you will need to close when you are done.
    1. $ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "" -Credential $credential -Authentication "Basic" -AllowRedirection
    2. Import-PSSession $ExchangeSession

      Use the following to remove your session when you are done working with Skype

    3. Remove-PSSession $ExchangeSession

That will do it. You can now PowerShell against O365 until the cows come home. I have some videos/posts in the hopper that will take a deeper dive into using this stuff. This post was just to make sure you could get started.


SharePoint, Azure, O365, & PowerShell Consulting

Using PowerShell with Azure

Seems like something reasonable anyone using Azure would want to do. After all, one of the draws of “the cloud” is automation. So I thought I would throw together a quick video and blog post on how to do it.

If you don’t want to read the small book I wrote below or need deeper demos and explanations check out my video Installing the Azure PowerShell cmdlets.

The long story short is it really only takes two cmdlets:

Install-Module AzureRM


Install-Module Azure

But unfortunately, it isn’t always quite that simple.

Why two modules?

The AzureRM module is the latest greatest and installs the Azure Resource Manager cmdlets. That is all of the fancy new stuff. The easiest way to equate it, though not completely accurate, is it is the same as the new environment. Anything, new and fun going forward is being done with Azure Resource Manager. 1,398 cmdlets to play with.

The Azure module is the old service manager cmdlets. Anything that you do in the Azure portal that is called Classic or old is what this module represents. While if you are new to Azure you should be able to avoid most of this stuff some features haven’t made their way to the RM module yet so good to go ahead and install these. 708 more cmdlets to enjoy.

If you want a better explanation of what the module are and do, then you can read this Microsoft Azure documentation. It does a good job of explaining what it is doing but it doesn’t do a very good job of explaining how to install things. So that is where this blog post picks up.

Step 1: Permissions

To install these modules, you will need to run your PowerShell session as an Administrator. Also, you will have to be running an execution policy of RemoteSigned or less. For Windows Server 2012 R2 this is the default. If you are installing on your Windows 10 machine though the default is restricted so you will need to change it.

To find your current policy you can use:


If it is set to Restricted, then you will need to run the following cmdlet to change it with following:

Set-ExecutionPolicy RemoteSigned

Unfortunately, the Azure cmdlets will only run with RemoteSigned or greater permissions so you will have to leave this changed going forward.

Step 2: Installing the Modules

Now that you have permissions set you can simply run the following:

Install-Module AzureRM

If this is the first time installing a remote module, then you will need to type Y to accept the NuGet module.

Then you will need to type Y again to say you trust the repository.

Once that finishes you will need to install the old modules (which are updated) with:

Install-Module Azure -AllowClobber

The reason for -AllowClobber is the two seems to bicker. So I just let the Azure module win and move on.

You will have to type Y again to say you trust the repository.

After a couple of minutes, you will have both modules installed and you will be ready to go.

Step 3: Logging in

Seems like a great next step.

To login to AzureRM use the following:


Now you will need to enter your Username and Password in the popup authentication box. After a few flashes, you are in.

To login to Azure Service Manager use the following:


The same process of logging into the authentication box that popups up and you are in business.

Step 4: The scripts that made me figure all of this out.

Running resources in Azure cost money and I don’t think anything quite runs up your bill like Compute. Unfortunately for me the main thing I do with Azure is use Infrastructure as a Service (IaaS) and incur all of those Compute charges. Since my money tree still isn’t growing in the back yard I try to minimize this spend. To do that I have created scripts for starting and stopping my Virtual Machines (VMs).

For Azure Resource Manger VMs I use:

get-azurermvm -ResourceGroupName proper2013 | foreach {start-azurermvm -Name $ -resourcegroupname proper2013

What that script does is starts all of the VMs in the “proper2013” resource group. If you are unfamiliar with resources groups check out Working with Resource Groups in Microsoft Azure. One of my more underappreciated videos.

When the day is over and you want to stop all of those VMs just run the following:

get-azurermvm -ResourceGroupName proper2013 | foreach {stop-azurermvm -Name $ -resourcegroupname proper2013 -confirm:$false -force}

That script will deallocate your VMs compute resources (release its IP Address for example) which will save you compute charges. You will still incur storage charges, though. If you don’t want to deallocate the compute resources then you can add the -StayProvisioned option.

If you are still rocking Old School aka Classic VMs then you will use this to start those VMs:

Start-AzureVM -ServiceName VideoDemoClassicVMs -Name "*"

ServiceName is the Classic version of Resource Groups.

And because you aren’t printing money in your basement to stop them you should run:

Stop-Azurevm -ServiceName VideoDemoClassicVMs -Name "*" -Force

Step 5: Stop reading and go play

There are about a million (2,106) more things you can do now that you are connected to your Azure account with PowerShell so go forth and learn. Other resources to help you out if you aren’t terribly comfortable with Azure and or PowerShell yet.

Until next time,

Shane – @ShanesCows

Bold Zebras - Microsoft Cloud Consulting

Bold Zebras – Microsoft Cloud Consulting

Installing SharePoint 2016 on Azure

Looking at my YouTube content it has been brought to my attention on Twitter that I don’t have a video that people expect. How to install SharePoint Server 2016 on Azure IaaS. Whoops. I realized that I have all of the pieces I just haven’t put the story together. So before I bust out the camera, microphone, and makeup (just kidding) I thought I would put together a blog post that gives you the plan in the short term.

In Azure, you will need to create a minimum of three VMs and you will need to put those VMs in the same Resource Group to make your life easier.

  1. Create a Domain Controller VM
    1. Create a new resource group
    2. Give it a static IP
    3. Update Azure Networking with static IP for DNS
    4. Will be a domain controller for your new forest and DNS server
    5. Step-by-Step video Create a new Active Directory Forest in Azure
  2. Create a Windows VM for SQL
    1. Put it in same Resource Group (working with Resource Groups in Azure)
    2. Join to Azure domain (Add a server to the domain in Azure)
    3. Install SQL and configure it for SharePoint.
    4. Step-by-Step video for SQL 2014 or SQL 2016
  3. Create a Windows VM for SharePoint
    1. Put in same Resource Group
    2. Join to Azure domain
    3. Step-by-Step video Install SharePoint Server 2016
    4. Step-by-Step video Install Cumulative Update for SharePoint Sever 2016 This step is optional. I would consider starting with September 2016 CU
  4. Step-by-Step video Configure SharePoint Server 2016 the right way

There you go. If you want a guide through the whole process, there it is. The good news is I see how that is annoying and that the SharePoint videos are shown with Hyper-V. So next week I will sit down and reshoot all of this 100% from Azure.

If you do watch any of these and have ideas or suggestions on what I should do differently or better, I am all ears.

Shane – @ShanesCows

Bold Zebras - Microsoft Cloud Consulting

Bold Zebras – Microsoft Cloud Consulting

Things you need to know about the September 2016 updates for SharePoint 2016

As you probably know last week the September 2016 Cumulative Updates were released. Before you go installing them there are some things you need to know.

If you are the type who reads all of the KBs associated with the updates and the warnings they contain then kudos to you but since most people just download and install we need to have an intervention. Why? Because this update makes some pretty significant changes under the hood to SharePoint. And while those updates are important for SharePoint going forward (some are guessing this CU will be required to get future updates) they make the patching process take FOREVER this time around. It took me close to 3 hours to patch my single server test environment with no content. That is crazy long. And it isn’t just running psconfig it is all parts. Here are some of the outliers.

  • Running sts2016-kb3118289-fullfile-x64-glb.exe took 1 hour and 32 minutes
  • Step 9 of config wizard took 31 minutes (August update it took 7)
  • Step 10 of config wizard took 18 minutes (August took 1 minute)

So the reason I point out these long times is it is real easy to think something is broke. Which might cause you to do something like use Task Manager to kill off one of these process which would lead to fire. So be calm and patient as you work through the process.

More bad news if you have on-prem MySites. Part of those is a site collection called https://sitemaster* gets created to allow for fast site collection creation. Well, that site collection causes a warning because it doesn’t get upgraded. My gut tells me this isn’t an issue and I am trying to confirm that but still another uneasy feeling when you are done.

Luckily for you I cover all of this with my video of doing the install. You can check it out here. Installing September 2016 CU for SharePoint Server 2016. It is part of my series on installing updates. There is a 2013 and 2016 series on YouTube for your viewing pleasure.


Installing SQL Server 2014 or 2016 for SharePoint on-prem

Do you have challenges with what is the correct way to install SQL Server for SharePoint? What features do you have to select? How should you configure the service accounts?

Or maybe installing SharePoint is fine but you don’t understand things like Max degree of parallelisms or what holes to punch in the firewall? No problem.

I have created two separate videos for installing SQL 2014 and SQL 2016 for SharePoint. Both videos use the 180-day trial so you can play along at home without a license. Good news is the steps are exactly the same if you are using a real license.

Neither video is going to make you an expert but they will get you to a solid point that makes SharePoint happy.

Installing SQL Server 2016 for SharePoint on-premises

Installing SQL Server 2014 for SharePoint on-premises

And if a proper install isn’t your thing then you can always use my quick and dirty video. That video covers using the Azure SQL Image and getting it ready for SharePoint.

Quick and Dirty SQL Server configuration using the Azure image (Link is to creation of SQL VM in Azure. 20 min 30 sec starts config portion.)

Check them out and let me know what you think. I am always looking for suggestions for future videos.


Installing and Configuring SharePoint Server 2013 on premise for Microsoft Azure

In case you are wondering this is completely different than the Quick and Dirty install video. This video goes through all of the steps to build a production grade install of SharePoint.

What? That seems really confusing. How do you do on-prem SharePoint 2013 on Azure? You use IaaS (Infrastructure as a Service) of course.

In this video, we start with nothing and build out all of the pieces to install SharePoint Server 2013. While the video shows it how to do everything in Azure you can adapt the steps to do an install inside your own network just as easy.

Domain Controller

  • We create a VM DC1 and set a static IP
  • We make changes to the Azure Virtual Network
  • We DCPromo the server and create a new domain
  • All of those steps and a lot more are covered in this video: Create a new Active Directory Forest in Azure

SQL Server 2014 SP2

  • We create a VM SQL1
  • We install SQL Server 2014 SP2 180-day trial
  • We set all of the security and settings to make SharePoint happy
  • All of those steps and more are covered in this video: Install SQL Server 2014 for SharePoint

SharePoint Server 2013 Install

  • We create a VM SP1
  • We install SharePoint Server 2013 RTM 180-day trial
  • We install Service Pack 1
  • We install June 2016 Cumulative Update
  • All of those steps and more are covered in this video: Install and Configure SharePoint Server 2013 on-prem using Microsoft Azure – Part 1

SharePoint Server 2013 Configure

  • We use PowerShell to create our farm
  • We walk through the service accounts and least privileged security concepts
  • We create all of the service applications with database names without GUIDs
  • SharePoint is up and fully functional for you to use
  • All of those steps and more are covered in this video: Install and Configure SharePoint Server 2013 on prem using Microsoft Azure – Part 2

That should do it. Walk through all of that content and you can have a SharePoint 2013 Server up and running in Azure. Pretty awesome!

For this video, there is also a premium guide available. The premium guide just documents all of the steps in an easy to following guide with numbered steps, bolded actions, and screenshots. Additionally, it includes automated PowerShell scripts that allow you to avoid all of the typing demonstrated in the video. Finally, there is a script and Excel file that will create the active directory accounts for you. It is preconfigured to create all of the accounts in the video but is easy to update to add additional accounts for testing or to change the names to meet your domain standards. For more information, check out

Let me know what you think and if you have suggestions for future videos.


 PS – I have the same thing available for SharePoint Server 2016

SharePoint 2013 – Quick and Dirty install on Microsoft Azure

What fun. For some reason this weekend I got inspired to do a quick and dirty install of SharePoint. I originally wanted to call it what not to do but that seemed to negative.

The idea is I plow through a way to get SharePoint 2013 up and running in Azure as quick as possible. The video turned out to be about 27 minutes to show what took me 1 hour 7 minutes to do. I also incorporated something new on this video. I run a stopwatch the whole time that you can see you know how long things are taking in real time vs. produced video magic. I take a lot of pride in cutting out every second or ten of screen waiting time to make the videos as short as possible. Hopefully you enjoy the timer that shows that off better.

In case you are wondering what a quick and dirty install using Azure looks like here is the outline:

  • Create a domain controller on Windows 2012 R2
    • Set a static IP
    • Update the virtual network to reflect the IP
    • DC Promo
    • Create two service accounts
  • Create a SQL 2012 SP3 Standard VM using template
    • Add it to the domain
    • Update security to give domain admin system administrator role
  • Create a SharePoint Server 2013 VM using template
    • Create the farm using configuration wizard
    • Configure the service apps using the wizard
  • At the end show you the train wreck it creates in SQL

That is as quick and dirty as it gets.

You can watch the video here: Configure SharePoint 2013 on Azure

Give it a watch and let me know what you think. Also, I am always up for new ideas so feel free to leave a comment of future videos you would like to see.


Next Page »