Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

861 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