Solved

Powershell studio run as

Posted on 2016-09-27
3
36 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Hi all.   The other day I had to change the passwords for a bunch of users on the fly. Because they were so many, I decided to do it in an automated way and I would like to share it with you all.   If you are not doing it directly in a Domain Co…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now