While doing our project, we came to a position where we needed to have abt 40-50 users in SAM database and to add them using GUI would be a very lengthy process.
Now to add users automatically, prepare a file with the names of users to be added to VDI Mgmt Console and then provide it as input in the script. One example of such script is:-
$fileinput=Get-Content 'C:\Users\zed\Desktop\input.txt'
foreach($i in $fileinput)
{
add-adminuser -DisplayName $i -UserName $i -DomainName localhost
}
So we decided to use command prompt.
All you have to do is to create a .BAT file and add the following command to it.
net user (username) (password) /add /comment:"Test user, DELETE ME"
net user Rahul abcd /add /comment:"Test user, DELETE ME"
So, add the user names and passwords below one by one and run the bat file. All will be added.
To remove them, again create a .bat file and use this command.
net user Rahul /delete
So, we just created the file, added 20-30 lines with username and password and got them added to database.
Now to add users automatically, prepare a file with the names of users to be added to VDI Mgmt Console and then provide it as input in the script. One example of such script is:-
$fileinput=Get-Content 'C:\Users\zed\Desktop\input.txt'
foreach($i in $fileinput)
{
add-adminuser -DisplayName $i -UserName $i -DomainName localhost
}
For removing users from SAM database, you need to provide him the simple remove.bat file with remove command for all users and he can successfully remove all the user accounts.