Solved

Powershell studio run as

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Set OWA language and time zone in Exchange for individuals, all users or per database.
A brief introduction to what I consider to be the best editor for PowerShell.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the adminiā€¦

749 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