1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
| Option Explicit
Dim objmenu, servername, username, wshshell, fso
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
'insertion du nom du serveur
servername=InputBox("Enter your server name(servername or IP)", "Enter Servername")
'insertion username
Username = InputBox("Enter your admin username (domain\username)", "Enter Username")
'create an object from the gui_menu class
Set objmenu = New gui_menu
'start the application
objmenu.getInput
Class gui_menu
private Input, quit, strText, cmd, arrMenu, i, return, strProg
Private Sub pickInput
'if you add anything to the menu array below, make sure you add a corresponding entry here
Select Case Input
Case "1"
cmd = " ""mmc %windir%\system32\compmgmt.msc"""
startProg cmd
getInput
Case "2"
cmd = " ""mmc %windir%\system32\dsa.msc"""
startProg cmd
getInput
Case "3"
cmd = " ""mmc %windir%\system32\tsmmc.msc"""
startProg cmd
getInput
Case "4"
cmd = " %comspec%"
startProg cmd
getInput
Case "5"
cmd = " ""mmc C:\Program Files\Microsoft SQL Server\80\Tools\Binn\SQL Server Enterprise Manager.MSC"""
startProg cmd
getInput
Case "6"
strProg = InputBox("Input the full path to the program", "User Defined")
If fso.FileExists(strProg) then
cmd = " """ & strProg & """"
startProg cmd
getInput
Else
strProg = MsgBox("File doesn't exist, try again!",48,"Error!!")
getInput
End if
Case "7"
quit = MsgBox ("Are you sure?", 36, "Want To quit?")'52
If quit = 6 Then
MsgBox ("Bye!!")
WScript.Quit
Else
getInput
End If
Case ""
quit = MsgBox ("Are you sure?", 36, "Want To quit?")'52
If quit = 6 Then
MsgBox ("Merci d'avoir utilisé ce portail!!")
WScript.Quit
Else
getInput
End If
Case Else
MsgBox ("That is an incorrect entry, try again")
getInput
End Select
End Sub 'pickInput
Public sub getInput
'add any menu names you want in this array, make sure you adjust the select/case in pickInput() accordingly
arrMenu = Array("Computer Management","DSA","RemoteDesktop","Command Prompt","SQL Admin","User Defined","Quit or click Cancel")
strText = "Enter selection below." & vbNewLine
'build the menu
For i = 1 To (UBound(arrMenu) + 1)
strText = strText & i & ". " & arrMenu(i - 1) & vbNewLine
Next
Input = InputBox(strText, "Make your selection")
pickInput
End sub 'getInput
Private Sub startProg(cmd)
return = WshShell.Run("%windir%\system32\runas.exe /savecred /user:" & username & cmd, 1, False)
End Sub 'startProg
End Class 'gui_menu |