I'm new to PowerShell scripts and want to create items in Sitecore's Shared Data folder in a Json file and save the uploaded Json file in the App_Data directory's location. I tried using fullpath and relative path in the script, but it does not function and returns an error.

enter image description here

Please help me.

2 Answers 2


Try with powershell variable $SitecoreDataFolder to retrieve path related to App_Data, as from looking into the issue it seems its not getting the path you are specifying. If it doesn't work then do post your script here.

  • Thanks Rinku, the suggested solution is working as anticipated. Aug 22, 2023 at 6:42
  • Its great that it solves your problem..... :)
    – Rinku Jain
    Aug 22, 2023 at 6:45

A few things to keep in mind.

  1. When working with Sitecore Items you will need the PowerShell drive to be either master:, web:, or core:. This is necessary to ensure that the SPE provider is in use for managing content through the Sitecore API. This is when the ItemType would be something like a template name.
  2. When working with filesystem data you will need to ensure the drive selected is something like C:. As mentioned by Rinku the use of $SitecoreDataFolder is a way to ensure that the proper drive is provided.
  3. New-Item for the filesystem provider and SPE provider behave differently.

In your example you should run the command like the following:

New-Item -Path $SitecoreDataFolder\test-folder -ItemType Directory

Test Folder

You can use the command Receive-Item as seen in the docs to upload files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.