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 18.104.22.168973 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:
<gate name=”Console” token=”Console”/>
<gate name=”ISE” token=”ISE”/>
<gate name=”ItemSave” token=”ItemSave”/>
<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”/>
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.