Solved

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

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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:…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

10 Experts available now in Live!

Get 1:1 Help Now