Now Sitecore PowerShell Extensions provides a User Account Control (UAC) feature akin to that of Microsoft Windows. Security is very important, but can be annoying. Elevated session state is required to run the script. Each time when elevated session state expires then you will be prompt for credentials. Fortunatelly there are settings in 'Cognifide.PowerShell.config' file where default settings can be changed. For me the most inconvinience is that I need to edit file. Sometimes I do not have access to the server but only to the Sitecore client. Powershell will help a little :-)
I wrote a simple functions to get/set tokens in 'Cognifide.PowerShell.config' file.
Note: This command restarts Sitecore
# Download module from Powershell Galery Install-Module sitecore-automation Import-Module sitecore-automation Set-UAC4SPE -Token Console -Expiration '00:06:00' Set-UAC4SPE -Token Console -Expiration '00:06:00' -Action Allow
This script below is part of Sitecore Automation Module
Sitecore Powershell SPE Security