Solved

Powershell studio run as

Posted on 2016-09-27
3
66 Views
Last Modified: 2016-09-27
Has anyone used powershell studio before? I am using it and want create a form that will allow some of our staff to move users around in active directory.  I can create the form and it works but if I want a non domain admin to run the software they cannot modify the AD. I expect this but I see there is a "run as" setting in the deployment settings.  I have tried to enter in domain admin credentials but when I run it as another user the form does not launch. It says "the directory name is invalid".  I can launch the program just fine if I am logged into the account that I entered in the "run as" settings and the form opens fine for all users if I don't enter a user in the run as settings.
0
Comment
Question by:Roccat
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 41817983
Use -Verb Runas to run the PowerShell session 'Run As Administrator' from an non-elevated session
Example, the code which you want to run with elevated privileges can be placed in scriptblock ..
Start-Process Powershell.exe {
  #Your code here 
    Get-WinEvent -ListLog Security
  #Above is sample code
} -Verb Runas

Open in new window


Ref: http://ss64.com/ps/syntax-elevate.html

PS: If this didn't fix your issue, then please post the exact error message and the code block which fails so we can take a look at it.
0
 

Assisted Solution

by:Roccat
Roccat earned 0 total points
ID: 41818121
Thank you Subsun. It appears this is the solution.  
"Launch the file from a folder that is accessible for all users and processes and you should not get that message."

I place the exe file that poweshell studio creates and put it in the root of the C drive and it worked.
1
 

Author Closing Comment

by:Roccat
ID: 41818123
Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
A brief introduction to what I consider to be the best editor for PowerShell.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question