Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Powershell studio run as

Posted on 2016-09-27
3
Medium Priority
?
132 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

661 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