Library code snippets

Start a Process as a Different User

To use this code please create a new module or add it to your existing project.

Function ConvertToSecureString(ByVal str As String)
        Dim password As New SecureString
        For Each c As Char In str.ToCharArray
            password.AppendChar(c)
        Next
        Return password
End Function
Sub Main()
       dim username as string = "Administrator"
       dim password as SecureString = ConvertToSecureString("my password")
       dim domain as string = Nothing
       dim filename as string = "notepad.exe" ' %SYSTEMROOT%\system32
        Try
            System.Diagnostics.Process.Start(filename,username, password, domain)
        Catch ex As Win32Exception
            MessageBox.Show("Wrong username or password.", _
"Error logging in as administrator", MessageBoxButtons.OK, _
 MessageBoxIcon.Error)
        End Try
End Sub

Comments

  1. 01 Jan 1999 at 00:00

    This thread is for discussions of How to start a process with a different user .

  2. 01 Sep 2006 at 21:59

    Purely out of interest is there any reason why a modified version of this code couldn't be used to crack the administrators password? For example technically every time you catch the error from an incorrect attempt you could increment the password (brute force style) and then try again in a big loop. the second you're sucessful you'd know the admin password. Might try this in a bit...is there any reason it wouldn't work? If it worked it'd allow anyone who can log into the system as an level user to break administrator access. And while it's all local and data doesnt go over the net, the cracking speed would in theory be phenominal

  3. 25 Mar 2007 at 12:39
    You said over the net , I am wondering - since one "should" not be able to start a process from a web browser - could they ??
  4. 29 Dec 2008 at 00:15
    thank you http://www.agbabanakliyat.com/
  5. 21 Jul 2009 at 03:20
  6. 12 Aug 2010 at 07:44

    fantastic program about project.

    Purely out of interest is there any reason why a modified version of this code couldn't be used to crack the administrators password? For example technically every time you catch the error from an incorrect attempt you could increment the password (brute force style) and then try again in a big loop. the second you're sucessful you'd know the admin password. Might try this in a bit...is there any reason it wouldn't work? If it worked it'd allow anyone who can log into the system as an level user to break administrator access. And while it's all local and data doesnt go over the net, the cracking speed would in theory be phenominal

    regards, phe9oxis, http://www.guidebuddha.com

Leave a comment

Sign in or Join us (it's free).

Peter Rekdal Sunde

Related discussion

Related podcasts

  • Software Engineering Radio: Web App Security with Bruce Sams

    Published 1 year ago, running time 0h57m

    Podcast (MP3): Download Hosts: Markus Guests: Bruce Sams Recording venue: OOP 2009 The majority of hacker attacks (70 %) are directed at weaknesses that are the result of problems in the implementation and/or architecture of the application. This session shows how... web, security, it, podcast

Related jobs

Events coming up

  • Sep 14

    CVINETA .net User Group meeting

    Cedar Falls, United States

    Speaker: Tim GiffordTopic: SOIL'D to SOLIDHave you ever worked on system that could be described as a "Big Ball of Mud"? Have you ever wondered what you could do to become a better developer?

Want to stay in touch with what's going on? Follow us on twitter or Facebook!