EPiServer Admin Mode PowerShell scripts

07 May 2011
Adam Najmanowicz
Frink_Cognifide_2016_HeaderImages_0117

The PowerShell plugin gets an update once again to support Admin mode script collections in addition to the context scripts.

How to write an Admin mode script collections?

<ContextScriptCollection>
  <Title>Statistics Scripts</Title>
  <Description>This script collection ... </Description>
  <Area>Administration</Area>

  <Scripts>
    <ContextScript>
      <Title>Restart Application</Title>
      <Description>The script restarts this instance of EPiServer...</Warning>
      <Script>Restart-Application</Script>

      <Icon>/App_Themes/Default/Images/Tools/Refresh.gif</Icon>
      <Groups>
      </Groups>
    </ContextScript>
  </Scripts>

</ContextScriptCollection>

Where can I access that?

image

Additional changes in this version

Scripts now have access to 3 starting predefined variables:

Name

Sample value

$AppPath

C:EPiServerSitesExampleEPiServerSite3

$AppVPath

/ (app virtual folder)

$tempPath

C:WindowsTEMP

$tmpPath

C:WindowsTEMP

and 1 more PowerShell Function have been defined: Reset-Application.

[Download & Enjoy]

Includes 3 bonus script collections!

How to install?

Extract the DLL form the ZIP file into the BIN folder of your web application to install the plugin. Remove the DLL to uninstall it.

All feedback appreciated!

Disclaimer – Responsibility: With great powers comes great responsibility – this tool can do a lot of harm to a lot of content in a very short time – backup your system before using the plugin! I will not be held responsible for any use of it. Test your scripts on your development server first! Test on an exact copy of production before running scripts on production content.


Disclaimer – Security: While the tool requires a membership in either the “WebAdmin” or “Administrators” group, to execute, protect it with a <location> entry in web.config, to add another layer of security especially if your administration UI is exposed to the public. Manage your group memberships & rights responsibly!