Windows Vista Forums

run a function within a script with different credentials
  1. #1


    RG Guest

    run a function within a script with different credentials

    I have a powershell script that is launching a process on a remote machine.
    I would like to have it so the script prompts for the persons username and
    password (get-credential) and then takes those credentials and uses them to
    launch the process. The script works find if I launch powershell with the
    credentials that need to launch the process on the remote machine, but if I
    launch the powershell script with credentials that don't have access to that
    machine it fails. Could somebody provide an example of this?



      My System SpecsSystem Spec

  2. #2


    David Trimboli Guest

    Re: run a function within a script with different credentials

    On 12/18/2009 6:46 PM, RG wrote:

    > I have a powershell script that is launching a process on a remote machine.
    > I would like to have it so the script prompts for the persons username and
    > password (get-credential) and then takes those credentials and uses them to
    > launch the process. The script works find if I launch powershell with the
    > credentials that need to launch the process on the remote machine, but if I
    > launch the powershell script with credentials that don't have access to that
    > machine it fails. Could somebody provide an example of this?
    Here is a blog that indicates you can do it with a
    System.Diagnostics.ProcessStartInfo object:

    http://tinyurl.com/yje49rx

    --
    David Trimboli
    Windows Systems Analyst
    Cold Spring Harbor Laboratory

      My System SpecsSystem Spec

run a function within a script with different credentials problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows 7 Login Script Prompts for user credentials Microsoft SBS Server 4 05 Feb 2010
Remote script with alternate credentials? Jo VB Script 1 11 Jan 2010
function -credentials TheOther Dude PowerShell 3 11 Sep 2009
running script with alternate credentials jorgemestre PowerShell 2 25 Feb 2008
Script-Function Help Dave PowerShell 7 22 Aug 2006