Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

864 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now