?
Solved

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

Posted on 2014-12-12
6
Medium Priority
?
63 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

800 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