Environment
8.7 to 9.6
Adding a Local User
A batch file can be used to add a local user to many machines at once.
The following is a sample batch file that will accomplish this task.
REM Add a user batch file net user john1 passwd! /add
However, maybe you do not want the username and password in the batch file in clear text. That batch file will hang out in the ldclient\SDMCache for a short time, as well as being echoed to the sdclient_task#.log in the ldclient\data directory.
So you can store the password in the command line of the Distribution Package.
REM Add a user REM %1 is the username REM %2 is the password REM Turn echo off so the password is not echoed to the log @echo off net user %1 %2 /add
Now in the distribution package simply put the username and the password in the command line. The password is still clear text in the Distribution Package, but only LANDesk administrators can see that so there is more security there.
Deleting a Local User
To delete a user, it is just as simple.
REM Add a user batch file net user John1 /delete
Adding Local Users from a .CSV File
Here is an simply one command in a batch file that will add all the users from a .csv file.
REM Add all the users from a .csv file REM Turn echo off so the passwords are not echoed to the log @echo off FOR /F "tokens=1,2 delims=," %%a IN (users.csv) DO net user %1 %1 /add REM Now delete the .csv file. We need to delete it, it has clear text passwords del /F /Q users.csv
The .csv file would look like this:
John,passwd!1234 Jane,passwd!1234 Jared,passwd!1234
Adding a Local Group
Use the following batch file to add a local group.
REM Adding a local group net localgroup MyGroup /Comment:"My own Group" /add
Deleting a local Group
Use the following batch file to delete a local group.
REM Adding a local group net localgroup MyGroup /delete
Adding a User to a Local Group
Use the following batch file to add a user to a local group.
REM Adding a user to a local group net localgroup MyGroup john /add
Deleting a User from a Local Group
Use the following batch file to delete a user from a local group.
REM Deleting a user to a local group net localgroup MyGroup john /delete
Managing a Local Administrator Account in Workgroup Enviroments
It may be beneficial, especially in Workgroup environments, to have the a local administrator account that has the same username and password on all workstations.
This can be done with this batch file.
REM Adding a local administrator REM Turn echo off @ECHO OFF REM Add the user net user ITAdmin %1 /add REM Put the password in the distribution package's command line REM Add the user to the group net localgroup administrators ITAdmin /add REM Remove the user from the default "users" group net localgroup users ITAdmin /delete