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

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 -- >

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.

Who is Participating?

Improve company productivity with a Business Account.Sign Up

HillwaaaConnect With a Mentor Commented:
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
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"

jgantesAuthor Commented:
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?

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.

jgantesAuthor Commented:
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!
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.

jgantesAuthor Commented:
Thanks a ton Hilwaa!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.