Library code snippets
Start a Process as a Different User
By Peter Rekdal Sunde, published on 09 May 2006
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
Related articles
Related discussion
-
dwwin.exe fails to initialize
by computerg33k (1 replies)
-
Select certain length of text...
by AaronHudson (2 replies)
-
Help to display image in .net mobile
by PinkuRaj (0 replies)
-
vb6 to vb.net chnages???
by Rollershade (3 replies)
-
Bug System.ArithmeticException (OverFlow and Under
by gr8_lover (2 replies)
Events coming up
-
Oct
24
MSDN Roadshow Re-Run
London, United Kingdom
Did you miss the opportunity to attend the MSDN Roadshow 2008? If so we are doing a Roadshow rerun giving you a second chance to attend this event. Come along if you want to find out about the latest developer tools and technologies from Microsoft. The MSDN team will focus on what’s coming up next this year for .NET developers beyond Visual Studio 2008. We will also look at Silverlight, ASP.NET, ADO.NET and other future bits which involve more code and less PowerPoint. Please be aware tha...
You said over the net , I am wondering - since one "should" not be able to start a process from a web browser - could they ??
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