automate new accounts

Rbartlem

Board Regular
Joined
Jun 9, 2004
Messages
172
BackTrackPasswords.xls
ABCDEF
1PasswordUserNameCompanyEmailAddressAddRemove
2bu0OB1PTAMPMTowingAMPMTowingAddRemove
3K9Yk7Lp0MMTowingM&MTowingAddRemove
4779H8PrLPJTowingPJ'sTowingAddRemove
5WW5Qn5Y5LouiesTowLouie'sTowingAddRemove
6H8jW6tKaOscarTowOscar's/WaikemTowingAddRemove
Sheet1


Ok... What I would like to do is make it so the add buttons and remove buttons do certain commands.... I tried using vbscript to make a standalone app to add

'NewBackupUser
Dim WshShell
Dim Message
Dim Title
Title = "Create New Backup User"
Set WshShell = WScript.CreateObject("WScript.Shell")
Name = InputBox("What would you like the username to be. Must be less than 20 characters and can

not contain \/:*?<>: or quotation marks",Title,"USERNAME", 4000, 2000)
Password = InputBox("What would you like the username to be. Must be less than 14 characters and

can not contain \/:*?<>: or quotation marks",Title,"PASSWORD", 4000, 2000)
Email = InputBox("What is the email address?",Title,"Email address", 4000, 2000)
WshShell.Run "RemoteManagementClient.exe xx.xxx.xxx.xx.x TapeStor CREATE " & Name & " "

& Password & " "" & Email & "" " & Email
Wscript.Echo "Done"

but I want the add button to do all that and instead of it prompting for username and password I want it to get them from their cell in the sheet... any ideas?

Code:
Code:
 
Rbartlem said:
Do I have to select the entire row or just one cell in that row for it to work?

Just one cell.

What you posted looks OK to me, but I don't know what the syntax is for your command.

To test if the correct command is being produced by the code try this:
Code:
Msgbox strCommand & strAccount

BTW why are you using the WSScript object?

Why not use the VBA Shell command?

Perhaps something like this?
Code:
Shell(strCommand & strAccount)
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I'm sorry I'm not sure what would need to be changed to use shell instead? or what needs to be changed to get the msgbox to work... what I tryed for the message box just gave me an error....


Code:
Sub NewUser()
   'Create New User
Dim ws As Worksheet
Dim strCommand As String
Dim strAccount As String
Dim UserRow As Long
    
    Set ws = ActiveSheet
    
    UserRow = ActiveCell.Row
  
    strCommand = "RemoteManagementClient.exe 66.106.68.226 2003 TapeStor CREATE "
    
    strAccount = ws.Range("A" & UserRow) & " " 'Company
    strAccount = strAccount & ws.Range("C" & UserRow) & " " 'Password
    strAccount = strAccount & Chr(34) & ws.Range("B" & UserRow) & Chr(34) & " " 'Username
    strAccount = strAccount & ws.Range("D" & UserRow) 'Email Address
                
    Set wsShell = CreateObject("wscript.shell")
    Set proc = wsShell.Exec(strCommand & strAccount)

    Set wsShell = Nothing
    Set proc = Nothing

End Sub
 
Upvote 0
What message box are you referring to?

To use shell it might look something like this:
Code:
Sub NewUser() 
   'Create New User 
Dim ws As Worksheet 
Dim strCommand As String 
Dim strAccount As String 
Dim UserRow As Long 
Dim retval    

    Set ws = ActiveSheet 
    
    UserRow = ActiveCell.Row 
  
    strCommand = "RemoteManagementClient.exe 66.106.68.226 2003 TapeStor CREATE " 
    
    strAccount = ws.Range("A" & UserRow) & " " 'Company 
    strAccount = strAccount & ws.Range("C" & UserRow) & " " 'Password 
    strAccount = strAccount & Chr(34) & ws.Range("B" & UserRow) & Chr(34) & " " 'Username 
    strAccount = strAccount & ws.Range("D" & UserRow) 'Email Address 
 
     retval = Shell(strCommand & strAccount)
            
'    Set wsShell = CreateObject("wscript.shell") 
'    Set proc = wsShell.Exec(strCommand & strAccount) 

'    Set wsShell = Nothing 
'    Set proc = Nothing 

End Sub
 
Upvote 0
Is there a way to make it so it doesn't automatically close the cmd window after the command is run? That way I can see how the server is responding...
 
Upvote 0
Take a look at the Shell statement in help.

You can pass another parameter that sets the window.

That might be what you are looking for.
 
Upvote 0
I looked but I can't find anything that will keep it open. Do you have any suggestions? Maybe I should start a new forum on Keep a shell window open ???
 
Upvote 0
It might be an idea to start a new thread.

When you used the other method did it keep the window open?

If it did you may as well revert to that.
 
Upvote 0
no both methods close automatically... I think I will start a new thread...

Thanks for your help!

:biggrin:
 
Upvote 0
Rbartlem

Is your code working other than having problems with keeping the window open?
 
Upvote 0
I don't have it configured on the server side yet to recieve the connection. I believe it is working but the only way for me to see for sure is if the window stayed open. That way when the server responds I can see what it says. If I could have it somehow echo whatever else is responded by the server that would work also.
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top