DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Ive created a sharepoint tool gui, and id love to be able to start it as administrator when people double click the .exe file.
I allready have the code to start form as admin:
PowerShell CodeDouble-click the code block to select all.
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
However, i cant find where to place it so that it will be the first line in the file.
If i first export my project to a .ps1 file and add the above code on the top and run it in powershell it works fine, starting the program as an admin. But where should i place this code in PowerShell Studio 2012?
best regards Bjorn
If you are posting a general PowerShell question please post in the PowerShell forum.
This forum is for technical support for our community tools only.
SAPIEN Technologies, Inc.
Who is online
Users browsing this forum: No registered users and 1 guest