PowerShell – stage 1

I have decided to prepare some PowerShell scripts to automatize my work with Sitecore. In this and next articles with PowerShell in the name, you will find some resolved issues and some useful scripts as well.

The NAME

As you can noticed in the title – I wrote PowerShell not Powershell or powershell or anything else. You should also remember about correct name.

I do not know if you noticed how people very often write Sitecore in the wrong way. I mean examples like “SiteCore” – looks strange right?

That is why we should care about details.

Prepare your system to run PowerShell scripts

After some fun with inline PowerShell scripts you probably will decide to create your first file with PowerShell script. Then probably you will have following error:

File XXX cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.

It means that you do not have enough permissions to run PowerShell scripts. You have to change that, for instance with following command (remember to open PowerShell Terminal in Administrator mode):

Set-ExecutionPolicy RemoteSigned

More about options you can find here: https://msdn.microsoft.com/powershell/reference/5.1/Microsoft.PowerShell.Core/about/about_Execution_Policies

Tools

To write/manage your PowerShell scripts you can use many tools. I have chosen Visual Studio Code. It’s simple, it’s for free and when you install PowerShell Extension it will have IntelliSense.

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz