Windows Vista Forums

run powershell always as admin ?

  1. #1


    Robert Ludig Guest

    run powershell always as admin ?

    A lot of powershell related tasks and commands require elevated right.
    How can I either

    a) run the powershell always as administrator
    or
    b) temporarily elevate the rights
    ?

    I suppose a) is a nono ?


      My System SpecsSystem Spec

  2. #2


    RichS Guest

    RE: run powershell always as admin ?

    If you are talking about running on Vista you can right click icon & run as
    administrator
    --
    Richard Siddaway
    Please note that all scripts are supplied "as is" and with no warranty
    Blog: http://richardsiddaway.spaces.live.com/
    PowerShell User Group: http://www.get-psuguk.org.uk


    "Robert Ludig" wrote:

    > A lot of powershell related tasks and commands require elevated right.
    > How can I either
    >
    > a) run the powershell always as administrator
    > or
    > b) temporarily elevate the rights
    > ?
    >
    > I suppose a) is a nono ?
    >
    >


      My System SpecsSystem Spec

  3. #3


    Robert Ludig Guest

    Re: run powershell always as admin ?

    On 25 Feb., 16:32, RichS <R...@discussions.microsoft.com> wrote:
    > If you are talking about running on Vista you can right click icon & run as
    > administrator


    Is there a way to create a shortcut or link that has "run as
    administrator" applied automatically? So that I do not have to bother
    to rightclick and can use keyboardhortucts to run the powershell?

    Also, is it safe to always runt the whole shell elevated?

    Is there a way to temporarily elevate the rights for specific tasks/
    commands? It seems I don't get the UAC promt when trying to execute
    commads that need elevated rights and the shell is not run as
    administrator. Instead I just get a permission error.


      My System SpecsSystem Spec

  4. #4


    Daymon Guest

    Re: run powershell always as admin ?

    In XP (or Vista), just create a standard shortcut to the powershell exe.

    Then in the properties of the shortcut, click the advanced button and check
    the run with different credentials.

    Now when you dbl-clk the shortcut, windows brings up the run-as dialog for
    you.

    "Robert Ludig" wrote:

    > On 25 Feb., 16:32, RichS <R...@discussions.microsoft.com> wrote:
    > > If you are talking about running on Vista you can right click icon & run as
    > > administrator

    >
    > Is there a way to create a shortcut or link that has "run as
    > administrator" applied automatically? So that I do not have to bother
    > to rightclick and can use keyboardhortucts to run the powershell?
    >
    > Also, is it safe to always runt the whole shell elevated?
    >
    > Is there a way to temporarily elevate the rights for specific tasks/
    > commands? It seems I don't get the UAC promt when trying to execute
    > commads that need elevated rights and the shell is not run as
    > administrator. Instead I just get a permission error.
    >
    >


      My System SpecsSystem Spec

  5. #5


    Robert Ludig Guest

    Re: run powershell always as admin ?

    On 26 Feb., 20:10, Daymon <Day...@discussions.microsoft.com> wrote:
    > In XP (or Vista), just create a standard shortcut to the powershell exe.
    >
    > Then in the properties of the shortcut, click the advanced button and check
    > the run with different credentials.
    >
    > Now when you dbl-clk the shortcut, windows brings up the run-as dialog for
    > you.
    >
    >
    >
    > "Robert Ludig" wrote:
    > > On 25 Feb., 16:32, RichS <R...@discussions.microsoft.com> wrote:
    > > > If you are talking about running on Vista you can right click icon & run as
    > > > administrator

    >
    > > Is there a way to create a shortcut or link that has "run as
    > > administrator" applied automatically? So that I do not have to bother
    > > to rightclick and can use keyboardhortucts to run the powershell?

    >
    > > Also, is it safe to always runt the whole shell elevated?

    >
    > > Is there a way to temporarily elevate the rights for specific tasks/
    > > commands? It seems I don't get the UAC promt when trying to execute
    > > commads that need elevated rights and the shell is not run as
    > > administrator. Instead I just get a permission error.- Zitierten Text ausblenden -

    >
    > - Zitierten Text anzeigen -


    This approach would still require me to enter the password for the
    admin account each time I run the shell. Wich is a bit annoying when
    using the shell frequently. Also what happens when I doubleclick .ps1
    files (wich starts the powershell), the executing script does not have
    elevated rights ...


      My System SpecsSystem Spec

  6. #6


    Joris van Lier Guest

    Re: run powershell always as admin ?

    Robert Ludig wrote:
    > On 26 Feb., 20:10, Daymon <Day...@discussions.microsoft.com> wrote:
    >> In XP (or Vista), just create a standard shortcut to the powershell
    >> exe.
    >>
    >> Then in the properties of the shortcut, click the advanced button
    >> and check the run with different credentials.
    >>
    >> Now when you dbl-clk the shortcut, windows brings up the run-as
    >> dialog for you.
    >>
    >>
    >>
    >> "Robert Ludig" wrote:
    >>> On 25 Feb., 16:32, RichS <R...@discussions.microsoft.com> wrote:
    >>>> If you are talking about running on Vista you can right click icon
    >>>> & run as administrator

    >>
    >>> Is there a way to create a shortcut or link that has "run as
    >>> administrator" applied automatically? So that I do not have to
    >>> bother
    >>> to rightclick and can use keyboardhortucts to run the powershell?

    >>
    >>> Also, is it safe to always runt the whole shell elevated?

    >>
    >>> Is there a way to temporarily elevate the rights for specific tasks/
    >>> commands? It seems I don't get the UAC promt when trying to execute
    >>> commads that need elevated rights and the shell is not run as
    >>> administrator. Instead I just get a permission error.- Zitierten
    >>> Text ausblenden -

    >>
    >> - Zitierten Text anzeigen -

    >
    > This approach would still require me to enter the password for the
    > admin account each time I run the shell. Wich is a bit annoying when
    > using the shell frequently. Also what happens when I doubleclick .ps1
    > files (wich starts the powershell), the executing script does not have
    > elevated rights ...


    Maybe you can use http://sudowin.sourceforge.net/

    regards
    Joris


      My System SpecsSystem Spec

  7. #7


    Lee Holmes [MSFT] Guest

    Re: run powershell always as admin ?

    In Vista's UAC model, you don't enable your Administrator rights for an
    application until you've gone through an elevation prompt. So yes, this
    means that you will be required to type in your credentials (or click "OK")
    whenever you want to load an elevated program (powershell included.) If
    there are aspects of this that frustrate you, then the best bet is to
    provide your feedback to the Vista UAC team --
    http://blogs.msdn.com/windowsvistasecurity/ may be a good starting point.

    As for your second point, double-clicking a script doesn't start PowerShell
    unless you've specifically modified your system to enable that. In that
    case, you may want to create a right-click menu option to execute the script
    using the Elevated PowerShell link that Daymon spoke about.

    That said, Michael Murgolo (who wrote "PowerShell Here"
    http://www.leeholmes.com/blog/PowerS...ePowerToy.aspx) will soon
    be releasing a little utility pack to make some of these scenarios easier.

    In terms of the safety of running PowerShell as administrator -- it's
    definitely a best practice to run without Administrator rights whenever
    possible. If you're just navigating the filesystem, changing files, running
    utility scripts, etc -- then I would advise running those in a regular
    PowerShell window. If you need to modify administrative data on the
    computer, then by all means perform that action in an elevated window.

    --
    Lee Holmes [MSFT]
    Windows PowerShell Development
    Microsoft Corporation
    This posting is provided "AS IS" with no warranties, and confers no rights.


    UAC is a core feature of Vista, so
    "Robert Ludig" <schwertfischtrombose@gmx.de> wrote in message
    news:1172561524.261387.249790@v33g2000cwv.googlegroups.com...
    > On 26 Feb., 20:10, Daymon <Day...@discussions.microsoft.com> wrote:
    >> In XP (or Vista), just create a standard shortcut to the powershell exe.
    >>
    >> Then in the properties of the shortcut, click the advanced button and
    >> check
    >> the run with different credentials.
    >>
    >> Now when you dbl-clk the shortcut, windows brings up the run-as dialog
    >> for
    >> you.
    >>
    >>
    >>
    >> "Robert Ludig" wrote:
    >> > On 25 Feb., 16:32, RichS <R...@discussions.microsoft.com> wrote:
    >> > > If you are talking about running on Vista you can right click icon &
    >> > > run as
    >> > > administrator

    >>
    >> > Is there a way to create a shortcut or link that has "run as
    >> > administrator" applied automatically? So that I do not have to bother
    >> > to rightclick and can use keyboardhortucts to run the powershell?

    >>
    >> > Also, is it safe to always runt the whole shell elevated?

    >>
    >> > Is there a way to temporarily elevate the rights for specific tasks/
    >> > commands? It seems I don't get the UAC promt when trying to execute
    >> > commads that need elevated rights and the shell is not run as
    >> > administrator. Instead I just get a permission error.- Zitierten Text
    >> > ausblenden -

    >>
    >> - Zitierten Text anzeigen -

    >
    > This approach would still require me to enter the password for the
    > admin account each time I run the shell. Wich is a bit annoying when
    > using the shell frequently. Also what happens when I doubleclick .ps1
    > files (wich starts the powershell), the executing script does not have
    > elevated rights ...
    >




      My System SpecsSystem Spec


run powershell always as admin ?
Similar Threads
Thread Forum
Stop a admin user changing another admin users password or deleting their account? Vista General
Re: run powershell always as admin ? PowerShell
Admin access to Vista Registry Remote & locally in Admin Approval Vista security
Modify PowerShell prompt when running as admin PowerShell
problem using Microsoft.Exchange.Management.PowerShell.Admin from C# PowerShell