SALinfo
asked on
script to create local groups in a list of servers
Hi Experts,
I am looking for a script to create local groups in a list of servers, i have got the batch script to create these local groups on a single server, but needs to run the script through a list of 100's of servers.
Please let me know how do i do that.
I have been trying this way:
set listsvrs=testusr
for %%i in (%listsvrs%.txt) do (
net localgroup "testuser" /ADD /COMMENT:"test user"
)
but it doesn't run this way and stops at "set listsvrs=testusr" mentioning the syntax of the command is incorrect.
Many Thanks
I am looking for a script to create local groups in a list of servers, i have got the batch script to create these local groups on a single server, but needs to run the script through a list of 100's of servers.
Please let me know how do i do that.
I have been trying this way:
set listsvrs=testusr
for %%i in (%listsvrs%.txt) do (
net localgroup "testuser" /ADD /COMMENT:"test user"
)
but it doesn't run this way and stops at "set listsvrs=testusr" mentioning the syntax of the command is incorrect.
Many Thanks
ASKER
Yes, i want the script to create local groups and run it as a loop on 100 different servers.
please let me know if you got any thing similar which can do what i am looking for
As mentioned above, i have got the script for creating local groups on a single and is working but i need it for it run and create those local groups on 100 list of servers picking up from servers.txt file.
servers is the list of servers in a text file
set listsvrs=servers
for %%i in (%listsvrs%.txt) do (
net localgroup "testuser" /ADD /COMMENT:"test user"
)
please let me know if you got any thing similar which can do what i am looking for
As mentioned above, i have got the script for creating local groups on a single and is working but i need it for it run and create those local groups on 100 list of servers picking up from servers.txt file.
servers is the list of servers in a text file
set listsvrs=servers
for %%i in (%listsvrs%.txt) do (
net localgroup "testuser" /ADD /COMMENT:"test user"
)
Here is some information on a script for creating local users on multiple remote computers:
VBScript to add local accounts on multiple machines
(see the bottom of the last post on that page for the script)
It can probably be easily modified to create local groups instead of local users.
VBScript to add local accounts on multiple machines
(see the bottom of the last post on that page for the script)
It can probably be easily modified to create local groups instead of local users.
ASKER
can someone pls help with the above batch scripting which is a simple way.
thx
thx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Note to my previous post
Target only the servers you want to add the group to
Target only the servers you want to add the group to
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also, you are looping and your variable is %%i but you are not using it...
Seems to me that what you are trying to do is run that command on 100 diffrent servers, but I dont see how you will manage by running that code on one of them... You need a script that logs on each and run that command.