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:
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Rbartlem

Board Regular
Joined
Jun 9, 2004
Messages
172
Basically I need the add button to run

Code:
WshShell.Run "RemoteManagementClient.exe 192.168.0.0 2003 TapeStor CREATE " & A1 & " " & D1 & " "" & B1 & "" " & C1

anyone have any ideas?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,219
Office Version
  1. 365
Platform
  1. Windows
Can you please supply some more information.

What do you mean by an 'account'?

Is this where you create the account?
Code:
WshShell.Run "RemoteManagementClient.exe xx.xxx.xxx.xx.x TapeStor CREATE " & Name & " " 

& Password & " "" & Email & "" " & Email
 

Rbartlem

Board Regular
Joined
Jun 9, 2004
Messages
172
that is what I type at the command prompt to add an account...


I have come up with
Code:
Sub NewUser()
   'Create New User

   Dim Command

   Command = "RemoteManagementClient.exe 192.168.0.0 2003 TapeStor CREATE " & A1 & " " & D1 

& " "" & B1 & "" " & C1
   
   Set wsShell = CreateObject("wscript.shell")
   Set proc = wsShell.Exec(command)

   Set wsShell = Nothing
   Set proc = Nothing


End Sub

But how do I get it to the add button and I'm not sure if that would even work....

I want it to change the a1 b1 c1 etc automatically ( so i don't have 500 macros) and I want it to happen when I click add...
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,219
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Well to get the value of a cell use Range("A1").

Can you explain further exactly what you want to do?

Do you want to got through every (non-empty) row and create accounts?

BTW Why have you got double quotes ("")?

Code:
Sub NewUser()
   'Create New User
Dim ws As Worksheet
Dim rng As Range
Dim strCommand As String
Dim strAccount As String
Dim LastRow As Long
Dim I As Long
Dim J As Integer
Dim retval

    LastRow = ActiveSheet.Range("A65536").End(xlUp).Row
    
    For I = 2 To LastRow
    
        strCommand = "RemoteManagementClient.exe 192.168.0.0 2003 TapeStor CREATE "
        
        Set rng = ws.Range("A" & I)
        
        For J = 0 To 3
            strAccount = strAccount & rng.Offset(0, I) & " "
        Next J
        
        Set wsShell = CreateObject("wscript.shell")
        Set proc = wsShell.Exec(strCommand & strAccount)

        Set wsShell = Nothing
        Set proc = Nothing
    Next I

End Sub
 

Rbartlem

Board Regular
Joined
Jun 9, 2004
Messages
172
the double quotes are because the command uses quotes as part of it. I would like the add remove listed to 500E or if I can make it intelligent and it adds the link add remove etc if something is entered into the first cell of that row that would be perfect
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,219
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Rbartlem said:
the double quotes are because the command uses quotes as part of it

The way you currently have your code wouldn't add quotes.

Can you post the syntax for the command?

I'm still unsure what you mean about the buttons.
 

Rbartlem

Board Regular
Joined
Jun 9, 2004
Messages
172
the acctual line that needs to be run is

RemoteManagementClient.exe 192.168.0.0 2003 TapeStor CREATE companyname userpassword "displayname" emailaddress

so a completed one should look like


RemoteManagementClient.exe 192.168.0.0 2003 TapeStor CREATE ABC Company MyPassword "abcompany" abc@email.com

and if you look at the above picture of the cell I would like it if when you clicked add it ran that command... if you clicked erase it would run

RemoteManagementClient.exe 192.168.0.0 2003 TapeStor DELETE "displayname"

( I would also like to add enable and disable next to those so they would be...

RemoteManagementClient.exe 192.168.0.0 2003 TapeStor ENABLE "displayname" 1

RemoteManagementClient.exe 192.168.0.0 2003 TapeStor ENABLE "displayname" 0


does that make more sense?[/code]
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,219
Office Version
  1. 365
Platform
  1. Windows
It makes more sense but doesn't sound like a good idea - do you really want buttons for every row.

Can you not just have one button that adds/removes according to the row that is currently selected?

Is B1 the display name?

To get the quotes you could try this:

...& Chr(34) & Range("B1") & Chr(34) & ...
 

Rbartlem

Board Regular
Joined
Jun 9, 2004
Messages
172
ok you lost me... I don't need the add, remove, enable, disable on every row if I don't need it. It would help remove a small chance of human error... I absolutely can't have an account deleted on accident. What code would I need to do to make them work?
Here is what I had currently...
(doesn't work right)


Code:
Sub NewUser()
   'Create New User

   Dim Command

   Command = "RemoteManagementClient.exe 192.168.0.0 2003 TapeStor CREATE " & A1 & " " & D1 & " "" & B1 & "" " & C1
   
   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 " & B1
   
   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 " & B1 & " 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 " & B1 & " 0"
   
   Set wsShell = CreateObject("wscript.shell")
   Set proc = wsShell.Exec(Command)

   Set wsShell = Nothing
   Set proc = Nothing


End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,123,143
Messages
5,599,975
Members
414,354
Latest member
Flaxarn

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
Top