Solved

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

Posted on 2014-12-12
6
47 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_
  • 4
6 Comments
 
LVL 15

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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 500 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article shows how a content item can be identified directly or through translation of a navigation type. It then shows how this information can be used to create a menu for further navigation.
This article will help you understand what HashTables are and how to use them in PowerShell.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
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…

706 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

18 Experts available now in Live!

Get 1:1 Help Now