Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

On a user without administration permission how can i launch a powershell script as ADMIN ?

Posted on 2014-12-12
6
Medium Priority
?
65 Views
Last Modified: 2015-06-22
Hello experts,


I need to let a user launch a powershell script.
the script needs administrator security level.

how should i manage this ?
i'm trying to figure out with shorcut that would launch as administrator but i dont succeed yet .


thank in adavance for all infos.

toshi
0
Comment
Question by:toshi_
[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
  • 4
6 Comments
 
LVL 17

Expert Comment

by:Ivan
ID: 40496244
Hi there,

here is a run as administrator shortcut that I used.

runas /savecred /user:domain\administrator "C:\script.exe"

First time you run it, it will open cmd windows, so you just enter administrator password, and there you go. The password will be saved, so user can run script unlimited number of times..or untill you change password.
You can enter local user or domain user that has rights to run that script.

BTW. What OS is in question?

Regards,
0
 

Author Comment

by:toshi_
ID: 40496275
thanks for the reply,

i'm going to try it.


sorry....the last message ^  didn't left. ..


btw, do you put this as a shortcut ? os in a batch file ?
0
 

Author Comment

by:toshi_
ID: 40496277
if in the shortcut , in which input text ?
Target? shorcut key ? ... ?
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 

Author Comment

by:toshi_
ID: 40496285
just browing on runas command, it's said that the param "savecred" is ignored on seven and on...
0
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 40512716
You can refer the following article which explains, how to run PowerShell script from a batch file with Administrative permissions..

http://blog.danskingdom.com/allow-others-to-run-your-powershell-scripts-from-a-batch-file-they-will-love-you-for-it/

Excerpt from Article..
@ECHO OFF
SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%MyPowerShellScript.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%PowerShellScriptPath%""' -Verb RunAs}";

Open in new window

0
 

Author Comment

by:toshi_
ID: 40533659
thanks a lot Subsun....
i'm just writing this comment in order to get more time and ask another questions...
please dont pay attention to it.... I'll be back ;)

toshi
0

Featured Post

Q2 2017 - Latest Malware & Internet Attacks

WatchGuard’s Threat Lab is a group of dedicated threat researchers committed to helping you stay ahead of the bad guys by providing in-depth analysis of the top security threats to your network.  Check out our latest Quarterly Internet Security Report!

Question has a verified solution.

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

There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
A walk-through example of how to obtain and apply new DID phone numbers to your cloud PBX enabled users that are configured in Office 365. Whether you have 1, 10 or 100+ users in your tenant, it's quite easy to get them phone-enabled and making/rece…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

618 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