So I've done an import before by specifying the domain and setting where to put the servers and it worked fine. However, I have another question.
In our main domain we have workstations and servers. We only want the servers in RDM. Is there a way to set the import to only bring in a specific OU and it's sub OUs? If not I know I can just import everything but I'll then have a ton of cleanup to do after the fact so I'd rather not have to do it that way.
Second question, is there any way to have RDM automatically scan AD for new entries on a schedule and add them into the list? Maybe there's some other way of refreshing the connections? We add new VMs all the time so I'm just looking for the best way so that the list in RDM is always as current as possible. I just don't want it to overwrite existing items in case we had to manually change a setting for a certain machine or added in a manual connection or something like that.
Thanks.
Hello,
What you are describing is ourActive Directory Synchronizer, you can find it under the Synchronizer section of our new entry dialog.
We are still behind in documenting this feature, let us know if you need more guidance. The settings are almost self explanatory ;)
Maurice
I found the option and can get it to Test OK until I type in the OU name that I want it to sync with. Then when I click Test I get a Failed error and it won't Preview. Is there a certain way I need to type in the OU we want to sync? It's just an OU called Servers in the root of our AD set.
Also, does the sync happen on a set schedule or how does that work? And if we modify a connection in RDM, will those changes get overwritten the next time is syncs?
Thanks.
I just whipped this up really quickly. It uses the RDM cmdlets for PowerShell (as well as the Active Directory module from Microsoft). It is meant to be run as a one-time sync. I will add some logic to it to detect AD object removal and pre-existing sessions in RDM; once done, I'll add it to the Powershell Repository in the forum.
<#
.SYNOPSIS
Remote Desktop Manager AD import script
.DESCRIPTION
This script will enumerate your AD OU's and query for AD computer objects running a Windows Server
Operating System. For each of those, the script will create an RDM connection mimicking the same
OU structure in AD.
.EXAMPLE
import-rdmadobjects
.NOTES
Name : import-rdmadobjects.ps1
Author : justpaul
Lastedit : 03/20/2015 16:23:05
.LINK
https://forum.devolutions.net/topic21268-importing-from-ad--couple-questions.aspx
#>
functionImport-RDMADObject {
[cmdletbinding(SupportsShouldProcess=$True)]
param ($ADObject)
$RDMDN=$ADObject.DistinguishedName
$RDMDNS=$ADObject.DNSHostName
$RDMName=$ADObject.Name
# A regex to split the DN, taking escaped commas into account
$DNRegex='(?<![\]),'
# We'll need to traverse the path, level by level, let's figure out the number of possible levels
$Depth= ($RDMDN-split$DNRegex).Count
# Step through each possible parent OU
$RDMPath= @()
for($i=1;$i-le$Depth;$i++){
$dnpath= ($RDMDN-split$DNRegex)[$($i-1)]
if($dnpath-like"OU=*"){
$rdmpath+= ($dnpath).Replace("OU=","")
}
}
[array]::Reverse($rdmpath)
if ($rdmpath){
$Group=$rdmpath-join"\"
} else {
$Group="Computers"
}
Write-Verbose"New-RDMSession -Group `"$Group`" -Name `"$RDMName`" -Host `"$RDMDNS`" -Kind `"RDPConfigured`""
$session=New-RDMSession-Group$Group-Name$RDMName-Host$RDMDNS-Kind"RDPConfigured"
Set-RDMSession$session
}
Import-ModuleActiveDirectory
#note you can edit the filter to get down to just what you'd want.
$ServerADObjects=Get-ADComputer-Filter {OperatingSystem-Like"Windows Server*"} |sortName
Foreach ($ADObjectin$ServerADObjects){
Import-RDMADObject-ADObject$ADObject-Verbose
}
Depending on the version you have, the test button may fail, but the sync works properly, so its best to save the session and to run it to have the sync run.
If you check the "synchronize automatically" option, it will run the sync after a small delay upon every refresh of the data source.
If you want finer control, you can disable the auto sync, but use a scheduler to "run" the session from the command line, the command line to use is displayed in the advanced tab of the session.
Maurice