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:
 
Have you tried/looked at any of the code I posted?

In your latest post you are still using A1, B1 etc.

If these are meant to be the values in those cells then use Range("A1").Value, Range("B1").Value etc
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
you had said that I made it wrong because of the double quotes... I wasn't sure if you still think I should use the first set of code you posted or the range part... I will change that... but does the code look ok? I thought it had to be completely redone?
 
Upvote 0
so this should work??? I'm sorry I am confused

Code:
Sub NewUser()
   'Create New User

   Dim Command

   Command = "RemoteManagementClient.exe 192.168.0.0 2003 TapeStor CREATE " & Range("A1").Value & " " & Range("D1").Value & " " & Chr(34) & Range("B1").Value & Chr(34) & " " & Range("C1").Value
   
   Set wsShell = CreateObject("wscript.shell")
   Set proc = wsShell.Exec(Command)

   Set wsShell = Nothing
   Set proc = Nothing


End Sub

-------------------------------------------------------------------------------------

Sub RemoveUser()
   'Remove User

   Dim Command

   Command = "RemoteManagementClient.exe 192.168.0.0 2003 TapeStor DELETE " & Range("B1").Value
   
   Set wsShell = CreateObject("wscript.shell")
   Set proc = wsShell.Exec(Command)

   Set wsShell = Nothing
   Set proc = Nothing


End Sub

----------------------------------------------------------------------------------------

Sub EnableUser()
   'Enable User

   Dim Command

   Command = "RemoteManagementClient.exe 192.168.0.0 2003 TapeStor ENABLE " & Range("B1").Value & " 1"
   
   Set wsShell = CreateObject("wscript.shell")
   Set proc = wsShell.Exec(Command)

   Set wsShell = Nothing
   Set proc = Nothing


End Sub

-----------------------------------------------------------------------------------------

Sub DisableUser()
   'Disable User

   Dim Command

   Command = "RemoteManagementClient.exe 192.168.0.0 2003 TapeStor ENABLE " & Range("B1").Value & " 0"
   
   Set wsShell = CreateObject("wscript.shell")
   Set proc = wsShell.Exec(Command)

   Set wsShell = Nothing
   Set proc = Nothing


End Sub

I'm sorry I am confused
 
Upvote 0
How about this for adding a new account?
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 192.168.0.0 2003 TapeStor CREATE "
    
    strAccount = ws.Range("A" & UserRow) & " "
    strAccount = strAccount & ws.Range("D" & UserRow) & " "
    strAccount = strAccount & Chr(34) & ws.Range("D" & UserRow) & Chr(34) & " "
    strAccount = strAccount & ws.Range("C")
               
    Set wsShell = CreateObject("wscript.shell")
    Set proc = wsShell.Exec(strCommand & strAccount)

    Set wsShell = Nothing
    Set proc = Nothing

End Sub
 
Upvote 0
How would I use it? do I have to select a row and then run the macro or make a button that runs the macro and select the row then click the button?
 
Upvote 0
Create a button and assign this to it.

Then select a cell in a row with data and press the button.

The code should then run taking data from the row you selected.
 
Upvote 0
It isn't working... it's having problems at

strAccount = strAccount & ws.Range("C")

I also don't really like having buttons, (sorry) I think it would work better if it had "add" in e "remove" in f "enable" in g and "disable" in h
 
Upvote 0
That should be

strAccount = strAccount & ws.Range("C" & UserRow)
 
Upvote 0
ok it's running now... I can live with using buttons I'm just worried that someone might accidentally click the wrong row and erase an account... how would I change that to work for the other buttons (remove etc.)
 
Upvote 0
Ok I think I got everything working. Do I have to select the entire row or just one cell in that row for it to work? I pasted code below for the remove user... Does that look correct?

Code:
Sub RemoveUser()
   'Remove 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 192.168.0.0 2003 TapeStor DELETE "
    
    strAccount = ws.Range("B" & UserRow) 'Username
                
    Set wsShell = CreateObject("wscript.shell")
    Set proc = wsShell.Exec(strCommand & strAccount)

    Set wsShell = Nothing
    Set proc = Nothing

End Sub
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,211
Members
448,554
Latest member
Gleisner2

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