Solved

Vb.net/c# code does NOT open process with admin account.

Posted on 2014-07-24
3
589 Views
Last Modified: 2014-08-02
Hi,
with below two codes I'm trying to open application on my computer. I'm an admin of computer, and would like to workout also for users, so they also could open application. Funny thing is that I'm able to open below Bp250mis.exe process, from original path. But, below codes are not able to open.

Any idea what could be wrong?
Thans in advance for help...

Imports System.Security
Imports System.Text
Imports System.Net

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim passwordPre As String = "test"
        Dim passwordChars As Char() = passwordPre.ToCharArray()
        Dim password As New SecureString()
        For Each c As Char In passwordChars
            password.AppendChar(c)
        Next
        Try
            Dim proc As ProcessStartInfo = New ProcessStartInfo()
            proc.FileName = "C:\Program Files\Aastra\Call Centre Supervisor V4\Programs\Bp250mis.exe"
            proc.WorkingDirectory = "C:\Program Files\Aastra\Call Centre Supervisor V4\Programs" '// <- Obbligatory
            proc.UseShellExecute = False
            proc.Domain = "test.com" '// Only in AD environments?
            proc.UserName = "test"
            proc.Password = password
            Process.Start(proc)
        Catch ex As Exception
            MsgBox(ex.Message)
            Exit Sub
        End Try
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Dim pw1 As String = "test"
        Dim passwd1 As New System.Security.SecureString
        Dim credential1 = New NetworkCredential("test", "test")
        pw1 = credential1.Password
        For I As Byte = 0 To pw1.Length - 1
            passwd1.InsertAt(I, pw1.Substring(I, 1))
        Next
        Dim process As New Process()
        process.StartInfo.UseShellExecute = False
        process.StartInfo.RedirectStandardOutput = True
        process.StartInfo.FileName = "C:\Program Files\Aastra\Call Centre Supervisor V4\Programs\Bp250mis.exe"
        process.StartInfo.Verb = "runas"
        process.StartInfo.Domain = "test.com"
        process.StartInfo.UserName = "test"
        process.StartInfo.Password = passwd1
        process.Start()
    End Sub

Open in new window

0
Comment
Question by:dejandejanovic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Expert Comment

by:Ess Kay
ID: 40217022
Why are you impersonating the Test user?

 process.StartInfo.Verb = "runas"
        process.StartInfo.Domain = "test.com"
        process.StartInfo.UserName = "test"
        process.StartInfo.Password = passwd1


Give Test User rights, add to AD..etc
0
 

Author Comment

by:dejandejanovic
ID: 40217874
Not able, as I'm not domain admin, but have limitation as admin. Also, by policy not able to add any user as local admin, like on specific computer.
0
 
LVL 15

Accepted Solution

by:
Ess Kay earned 500 total points
ID: 40217914
just remove that altogether,

dont impersonate, leaving it blank will open as yourself


if you want other users to open it, you will need to impersonate an account with access



Im not suggesting a keylogger for your supervisor, but perhaps, request from domain admin
0

Featured Post

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question