Need to have a program that runs under Limited User but allows launching of Command prompt, etc. w/ Admin rights

Posted on 2006-11-23
Medium Priority
Last Modified: 2010-04-23
Here's our dilemma.  We have an extremely locked down environment on remote machines (no command prompt, control panel, etc).  Rather than having to logoff/on each time, we need quick access to the command prompt.

We want a program that will a launch, prompt for a "daily passcode" (IE today's date * 5, or whatever).  Then, you click a button and it launches the command prompt.  Since the command prompt is BLOCKED by Group Policy, it needs to launch CMD.EXE w/ RUN AS but shouldn't prompt for the user.

Something like this -- > http://launch-admin.sourceforge.net/

The difference is, that we want it to be custom tailoried to our environment so we can add our "daily passcode" protection.

I'm not a programmer, but we have one here in our office that would understand VB .NET if I had the code.  We can also do in VB6 if it's easy enough -- But that may not be the way to go.

Question by:jgantes
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
  • 3
  • 3
LVL 16

Expert Comment

ID: 18001886
Hi jgantes,

if you put the following into a VB .NET project it will (when run) prompt you for the users's password then start cmd.exe.  There isn't a "/password" option for runas, so I don't think you can supply this easily.  If you still need the "daily passcode" as well as the user you could just craft a popup windows form that prompts for the passcode.  Let me know if you need a hand with this as well.

        Dim x As New System.Diagnostics.Process
        x.StartInfo.FileName = "runas.exe"
        x.StartInfo.Arguments = "/user:DomainName\AdministratorAccountName cmd.exe"


Author Comment

ID: 18004501
Hi Hilwaaa,

I'm thinking the daily passcode part should be prett straightforward.  I guess we're out of luck then on the "runas" situation.  Stinks that there isn't a way to automate the password portion --

I know there is a source forge project that provides a full-fledged app. that can launch items as another user, but it's not quite what we need.

What about user impersonation in VB?  Any ideas on that?


Author Comment

ID: 18006210
I found a third party product (that I was originally avoiding) that will do everything I need from a CLI.


I'll still need a program that opens up, prompts for a "daily passcode" and if correct, lets the person enter and click a button that launchs the my third party app w/ command line switches!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 16

Accepted Solution

Hillwaaa earned 900 total points
ID: 18006570
Hi jgantes - try this (was coded in VB .NET 2003):

Public Class Form1

    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        'This call is required by the Windows Form Designer.

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
            End If
        End If
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.Button1 = New System.Windows.Forms.Button
        Me.Label1 = New System.Windows.Forms.Label
        Me.TextBox1.Location = New System.Drawing.Point(136, 40)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.TabIndex = 3
        Me.TextBox1.Text = ""
        Me.Button1.Location = New System.Drawing.Point(160, 136)
        Me.Button1.Name = "Button1"
        Me.Button1.TabIndex = 4
        Me.Button1.Text = "OK"
        Me.Label1.Location = New System.Drawing.Point(8, 40)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(112, 23)
        Me.Label1.TabIndex = 5
        Me.Label1.Text = "Enter daily postcode:"
        Me.AcceptButton = Me.Button1
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(256, 174)
        Me.Name = "Form1"
        Me.Text = "Open Command Shell"

    End Sub

#End Region

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If (Me.TextBox1.Text.Equals(CStr(Now.Day * 5))) Then

            Dim x As New System.Diagnostics.Process
            x.StartInfo.FileName = "runas.exe"
            x.StartInfo.Arguments = "/user:Domain\UserAccount cmd.exe"
            MessageBox.Show("Invalid Passcode")
        End If

    End Sub
End Class
LVL 16

Expert Comment

ID: 18006575
You'll have to update the name of the application (and any arguments) - as well as change the daily passcode function if you don't want the day*5 formula.


Author Comment

ID: 18008826
Thanks a ton Hilwaa!

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

764 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