Posts

Showing posts with the label Scripts

Execute PowerShell Script with Sitecore Scheduler

Image
If you have a requirement like execute PowerShell script in form of a scheduler then Sitecore Scheduler provides an option for the same. For Example, you want to delete some Sitecore Items after a specific date or remove the ideal user at some specific time. For that, you have written a PowerShell script instead of C# code and you want to schedule the PowerShell Script with a Scheduler. Then Sitecore Scheduler provides you a good option to execute PowerShell Script. If you want to know How to Install the PowerShell module with your Sitecore instance and the ideas about the PowerShell command and Scripts then, please refer series of blog posts written on: PowerShell with Sitecore . Here I am giving you an example to create a Sitecore Item using PowerShell Script and Schedule that Script by Sitecore Scheduler. You can update your PowerShell script as per your requirement. Step 1: Go to the PowerShell ISE, you can open it by Sitecore Launchpad or

Import CSV Data in Sitecore Using PowerShell: Part-3

Image
In my previous blog , we had discussed Sitecore PowerShell Command and Scripts. In this blog, I am discussing with you about How to Import CSV Data in Sitecore using PowerShell Scripts? To do the same you need to read the CSV file rows and create Sitecore Items into the Content Tree for each row then assign the column values of the row into the respective Item Field. There are two options: Write your own customized PowerShell Script and Import CSV Data. Use the inbuilt Data Importer tool that comes with Sitecore PowerShell Extension .  Option 1: Perform the Below steps to Import the CSV Data into Sitecore: First, you will need a CSV file. If you have Excel Sheet, then go to the File Menu and click on Save As option and change the format and save it into CSV format. Suppose you have a CSV file with the number of rows and each row has several columns with predefined values. Here I am taking the below CSV file for an

PowerShell Commands and Scripts for Sitecore Item: Part-2

Image
In my previous blog , we had discussed Installation of the PSE module with Sitecore and Out of The Box Tools. In this blog, I am discussing with you some basic development of PowerShell Command and Scripts. Determine PowerShell version: Execute the below command will give you the all the details of installed PowerShell like Version, Edition, SPE module version, etc. In my case, I have installed SPE module 6.2.   $PSVersionTable Directory and Text file: Create a Directory into the system. Write text into the text file and save that text file in the system directory. Get Sitecore Item: You can get Sitecore Item by Path, ID, Sitecore Query. I am giving you an example with Path. In the above, I have set parameter value -ErrorAction SilentlyContinue which means the Get-Item command will execute without any error shown on the console in case it does not found any item on the path.   Now you can perform various o

PowerShell with Sitecore and Installation: Part-1

Image
PowerShell is a modern command-line shell, or we can say Scripting language framework.  It is a more influential tool compare to the command prompt. Sitecore PowerShell module increases your productivity, performance and saves your development time. It’s developed by Adam Najmanowicz and Michael West. It does not install OOTB therefore you need to install it manually. Using this module, you can perform serval operations on Sitecore Items like Add/Update/Delete, Get Child Items, Bulk Updates, Publish Items, Delete Items on specific conditions, etc. Install SPE Module: Go to the Sitecore Download website from here and select the Sitecore Version. Once you elect, it will redirect to the download section. Here I am selecting Sitecore Experience Accelerator 10.1.0, click on the link and it will redirect you to the  download section . Download the Sitecore PowerShell Extension for Sitecore. Install the Sitecore PowerShell