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..
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 email@example.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
3) Creating the admin user using the link
Set-User -Identity amit -IsAdministrator
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.
2) create-AdminUser -Verbose “amit3” “firstname.lastname@example.org” “amit thakur”
2) Creating PowerShell Report in Sitecore.
I written small script which return the name of all the admin user.
Below is the Output.
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”:
You will see your module name which contain the “Report” and under report save your code by giving the function name.
And here you go…