Sitecore Powershell Extensions: Ever wonder how to elevate your session without having to provide your credentials? Here is how

In today’s post we will review an interesting feature in Sitecore Powershell Extensions: How to elevate your session without having to provide your credentials. I’m using on today’s post SPE 4.4.1.29973 and Sitecore 8.2.

The idea for this post came when I was playing around with SPE and everytime I would run a script using ISE I would get prompted for my credentials like shown bellow:

I thought to myself “There has got to be a way to get rid of this popup while I’m still developing the script and want to run and test it”. And I found that actually there is. But this pop-up exists for a reason and you should consider it. But if you are just developing on your local and you know what you are doing keep reading 🙂

I’m logged in as admin(and yes “b” is still my password) so I’m already an admin with elevated privileges right? so what else should I do?

Well there is a section on the “Cognifide.PowerShell.config” config file which essentially guides this behavior:

<userAccountControl>
<gates>

<gate name=”Console” token=”Console”/>
<gate name=”ISE” token=”ISE”/>
<gate name=”ItemSave” token=”ItemSave”/>
</gates>
<tokens>

<token name=”Default” expiration=”00:00:00″ elevationAction=”Block”/>
<token name=”Console” expiration=”00:05:00″ elevationAction=”Password”/>
<token name=”ISE” expiration=”00:05:00″ elevationAction=”Password”/>
<token name=”ItemSave” expiration=”00:05:00″ elevationAction=”Password”/>
</tokens>
</userAccountControl>

 

You might be wondering what are gates and tokens. If you are have a look on this link.

So there are essentially two ways for you to elevate that privilege. One is to increase the expiration time on the ISE token, for example for a few hours or days. But you will have to provide your password at least once. Or you can essentially change to value of the attribute elevationAction.

In the code above it’s set to “Password” which means that you have to provide your password. The other values you can set are Block and Allow.

Block will block the execution of your code even if you provide your password showing you a message like this:

Allow will essentially achieve what you are looking for. You will be able to run scripts as much as you would like without providing your password.

Advertisements

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 )

Google+ photo

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

Connecting to %s