Solved

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

Posted on 2014-07-24
3
577 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
  • 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

832 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