Sitecore PowerShell Extensions

I have try to explain the basic step and cover the topic how you can install this module, create PowerShell function and  report in Sitecore. Also the example mentioned in the blog is the real scenario where i have used in my project which might help other also. Hope you will find this post useful.

Sitecore PowerShell can be downloaded easily from Sitecore MarketPlace.

This module should be installed only on Content Management Server for security reason.

Installing the PowerShell module.

1) Download the package.

2) Install the package in Sitecore.

3) You will see the PowerShell Console Screen

4) if you go in PowerShell Report, you can find all the inbuilt PowerShell Functions..

powershell1Powershell2

Scenario:-

There was a requirement to create more than 100 Sitecore Admin User at a time and how can I automate this process, rather than going and creating one by one user through sitecore content editor.

Below are the steps,

  • I created the new User, Using this Link

New-User -Identity amit -Enabled -Password b -Email amit-thakur@hotmail.com -FullName "Amit Thakur"

  • Below function Check whether the user has created or not in Sitecore Using this Link

PS master:\> Get-User -Identity amit 
Powershell3
3)  Creating the admin user using the link

Set-User -Identity amit -IsAdministrator
powershell4

 Creating Functions with default parameter

I have created the function which first check if the users already exist in the Sitecore, if yes it give the error accordingly otherwise it will go ahead and create the user
1)     Open the ISE and write the below functions.
powershell5
2) create-AdminUser -Verbose “amit3” “amit-thakur@hotmail.com” “amit thakur”
Powershell6

2) Creating PowerShell Report in Sitecore.

I written small script which return the name of all the admin user.
powershell7
Below is the Output.
Powershell8

Integrating with start Menu

The simplest way to let authors run scripts is to create a new SPE module and set the integration point to “Start Menu Reports”:
powershell9
You will see your module name which contain the “Report” and under report save your code by giving the function name.
powershell10
And here you go…
powershell11

If you have any thoughts on this, or would like to discuss on Sitecore PowerShell Extensions, please share your comment.

References

https://doc.sitecorepowershell.com/

https://marketplace.sitecore.net/en/Modules/Sitecore_PowerShell_console.aspx

https://blogs.perficient.com/sitecore/2018/02/05/writing-sitecore-powershell-reports-content-authors/

Advertisement

One thought on “Sitecore PowerShell Extensions

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.