I am trying to open a cmd window as an admin but it never works. I can open a command window but it does not open as the admin.. Here is my code (VB.NET 2008)..
'This is in a module
Public strUserName, strPassword, strDomain As String
Public SecPassword As New Security.SecureString()
Public impersonater As New ProcessStartInfo()
'This is in the login form
Dim i As Integer
strUserName = Trim(txtUserName.Text)
strPassword = Trim(txtPassword.Text)
strDomain = Environment.UserDomainName.ToString
For i = 1 To Len(strPassword)
SecPassword.AppendChar(Mid(strPassword, i, 1))
Next
'And finally the main form
Private Sub btnCMD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCMD.Click
impersonater.UserName = strUserName
impersonater.Password = SecPassword
impersonater.Domain = strDomain
impersonater.Arguments = "c:\"
impersonater.UseShellExecute = False
impersonater.FileName = "cmd"
Process.Start(impersonater)
End Sub