Forum / Remote Desktop Manager - PowerShell Repository

Mass import of AD Accounts into a SQL data source

  • Create an Issue
  • Cancel


Here is a script to do a mass import of AD user accounts that are members of an AD group into a SQL data source. Please adapt the script according to your needs.

Import-Module activedirectory

$users = Get-ADGroupMember "RDM Users"
$domainName = Get-ADDomain -Current LocalComputer

foreach ($user in $users) {
$loginName =$domainName.NetBIOSName + "\" + $user.SamAccountName
$rdmUser = New-RDMUser -Login $loginName -IntegratedSecurity
Set-RDMUser $rdmUser
Write-Host "User $loginName created!"

Write-Host "Done!!!"

If you want to run this script without running Remote Desktop Manager, you have to load the RDM PowerShell module with this command.

Import-Module "C:\Program Files (x86)\Devolutions\Remote Desktop Manager\RemoteDesktopManager.PowerShellModule.psd1"

Best regards,

Érica Poirier


Clock3 yrs