Solved

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

Posted on 2014-12-12
6
57 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 16

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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
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 …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

861 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