Solved

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

Posted on 2014-12-12
6
50 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now