Results 1 to 4 of 4

Thread: [2.0] Psi

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    [2.0] Psi

    I'm trying to run a process on another computer giving it user credentials however I always get the username or bad password exception. Any ideas what im doing wrong?

    ProcessStartInfo psi = new ProcessStartInfo("notepad");
    psi.Username = "Administrator";
    psi.Password = theSecureString;
    psi.Domain = "ComputerName";

    psi.LoadUserProfile = true;
    psi.UseShellExecute = false;

    Process.Start(psi);

    of course the username and password are correct.

    any ideas?

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Psi

    I could be wrong but I don't think that you can use Process.Start to start a process on another machine. I think that the Domain property indicates the domain in which the user credentials are valid, not the computer on which to run the process. I think that that code is trying to run a process on the local machine using the credentials that you're specifying, which are probably invalid for the local machine.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: [2.0] Psi

    could be.
    I know I can run a process using WMI in C# but I want it to automatically "appear" if the user is already logged in instead of running it in the background on a different account for example.....

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Psi

    I don't see that Process.Start would realy help there because you'd still have to determine who the logged on user was in order to the start the process as that user. I don't know for sure but I'd expect that WMI could do that just as easily.

    I looked a little further because I thought that this should be possible and it's not the ProcessStartInfo you need to adjust. I think something like this should work:
    Code:
    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    
    proc.MachineName = "MachineName";
    proc.StartInfo.UserName = "UserName";
    // etc.
    
    proc.Start();
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width