We need to run zero-touch inventory on our Citrix VDI parents and unique VDIs to support proper Citrix inventory and license entitlement mappings.
The problem is specifying inventory targets is a very manual process. It also expects your machines fit into nice groups like by name or subnet (which isn't realistic) or you need to specify each individual machine by name.
We have hundreds of VDI parents or unique machines which change frequently. Keeping the list of machines up to date in the inventory target list is not sustainable.
Has anyone had success populating inventory target via automation?
I would like to build a database script, batch process, or use the business adapter studio to remove and regenerate the inventory target list.
Looking for pointers on others who may be doing this or have ideas on how to accomplish this.
I have attached an example of a business adapter which populates an inventory target from an excel spreadsheet containing a list of server names.
The business adapter process
1. Clears the existing target list
2. Populates a staging table from the spreadsheet contents
3. Repopulates the target from the spreadsheet list of servers
I am using this automation to support the need to remotely inventory XenDesktop parents which is a pain to keep maintained for an organization our size.
You can reuse this for different purposes just remember I hardcoded the insert to the BeaconTargetDiscoveredDeviceMapping_MT table columns TenantID and Include to value of 1. This may need to be updated for your purposes. Any other changes needed for the business adapter xml are in <> brackets.
Please don't critique my work too much I didn't spend much time on this. It does work nice though.
Disclaimer here that this is fully untested and is more hypothetical but the table which contains the targets is BeaconTarget_MT and has a primary key of BeaconTargetID.
For devices which have already been discovered there is BeaconTargetDiscoveredDeviceMapping_MT which maps DiscoveredDevice.DeviceID to the BeaconTargetID from the previous table.
So depending on how you plan to populate the targets i.e. if you want to manually assign known devices then you might be able to create the rules, then using a script to populate BeaconTargetDiscoveredDeviceMapping_MT however as I said above this is untested.
If the solution provided has helped, please mark it as such as this helps everyone to know what works.
The method suggested by Matt works, I've used it in a couple of cases.
The best method I found was to combine it with a Business Adapter to be able to pull targets from lists. I used to have an adapter that did this but I can't find it now
@mrichardson Thanks Matt for describing where things are in the database. I had looked at these very tables but was confused because it would seem the storage of the entry is in a different table depending on if it was a IP vs. site\subnet vs. hostname. I put on the brakes and came here.
@dsalter , very interesting use case indeed! Have you put a solution together?
@TeemuK , have you by chance found the adapter? Using BAS is what I was thinking.
Here is my situation: We are deploying the FlexNet agent via adaption to all servers. The account empowered to adopt is (say) cnet\FNMAgentInstallerEast. There is an AD group called DataCenterEast.Servers which have (say) 1000 servers in it... updated daily so it is always changing (servers being added and removed).
We use the below PowerShell to get these servers and more important, their assigned IP address
# Get each hostnames from AD group DataCenterEast.Servers
$computerlist = Get-ADGroupMember DataCenterEast.Servers | Select-Object Name
# Get IP for each hostname and output to csv (computersips.csv)
foreach ($computer in $computerlist)
[system.net.Dns]::GetHostAddresses("$computer") | Foreach-Object
add-content -path C:\temp\computersips.csv -value "$computer,$($_.IPAddressToString)"
The resulting csv is the source data we'd like to use to populate the target. Hostname would be more human-readable but, because we can't guarantee that the server has been discovered (hence, you're not allowed to add by hostname in the target), we are fine with using IP. Note: I could do a join with discovered devices table and make it Hostname if discovered or IP if not but that can be v2 -- just looking to keep it simple to start!
The cool thing is that, where a customer would do such a thing like populate an AD group with the servers the installing account has purview over, the target that could be created would be "DataCenterEast (FNMAgentInstallerEast)" and it would be understood and expected that each server be properly and swiftly adopted.
The AS-IS method: add each IP manually.
Any thoughts would be appreciated and especially if there's been something done adapter-wise that has produced this automation.
Thanks, Rob A
At this point we haven't implemented this automation. We found some trouble with duplicate of IP and Names in Discovered devices that presented a challenge, I assume we could use all matching records. We found no way to accomplish this through the Business Adapter Studio (BAS). My next steps were to look at building a powershell script to pull the data we needed and directly repopulate the inventory target directly into the appropriate database tables. I had some other priorities but will look to due this in the future.