Export hosts from Active Directory to FOG database

  • Hi everyone,

    In my work we are testing FOG as a possible solution to simplify work -we install ALL the computers one by one!-. I’ve been asked if machines currently registered in Active Directory can be exported to FOG database, so we don’t have to manually register them in FOG.

    Any help is really appreciated.

  • Moderator

    As far as I know, there is currently nothing in Fog to set it up to have a structure like Active Directory. Fog cannot directly talk to active directory, but when the new UI comes out and allows easier creation of custom pages, it might be possible to add LDAP functionality to help achieve what you want, but it’s not in vanilla Fog.

    I’m curious what you are trying to achieve overall by setting Fog up to mirror AD.

  • This post is deleted!

  • [quote=“chad-bisd, post: 3172, member: 18”]I’m confused. Are you wanting to use Fog to image computers that will be joined to a domain or are you just trying to get the Fog client onto existing computers which already exist in an AD domain?[/quote]
    If it is possible, I want something that feeds from Active Directory. In my institution environment, machines are constantly created and deleted from the Active Directory, so the aim is that FOG has a real-time picture of AD, including its structure (OU’s).
    Something like SCCM and/or Altiris do.
    I am looking at the Wiki and I cannot find anything.

    Any idea?

  • Moderator

    I’m confused. Are you wanting to use Fog to image computers that will be joined to a domain or are you just trying to get the Fog client onto existing computers which already exist in an AD domain?

  • thanks Chad, didn’t realise you could auto-register with the client, tbh I’ve never used the client in a domain environment. But am planning to use this for our student images (workgroup) for remote sites.

    Slightly off topic but the client needs to be configured with fogs IP address (or host) according to the screenshot on the wiki.
    I want to use a universal image and not have to hard code specific IP addresses, so I guess I should use a name. But then the next challenge is to get these student machines to resolve that name without a dns server, reason being they will use their own ISP, I guess a workaround would be to make fog a dns server also, just to resolve the fog server itself and then pass everything else to the ISP.

    I’m all ears if there’s a more elegant solution.

  • Moderator

    I think pushing the clients and enabling the auto register is the way to go.

    You can, if you just can’t get that to work, use the network scanners to get MACS linked to host names and import that.

  • This is a tool I use often - [url]http://www.softperfect.com/products/networkscanner/[/url]
    You can use it as ssx4life mention, to scan the network and export the computer names and macs.

    If you want a slightly more automatish way of extracting macs from your domain you can actually query the dhcp server with netsh.

    We have a lease time of 3 days so I have a script (mixed with grep and sed from unix tools - [url]http://unxutils.sourceforge.net/[/url] ) to query the dhcp server and extract the macs to a file, then filter and export to a bigger / master file that I use for wake on lan scripts (nightly virus scans).

    Here’s a script I use (you can amend to include the computer name)

    [CODE]:: Script to extract mac addresses from DHCP for both subnets.

    :: Delete macsDB.txt if exists
    if exist “C:\scripts\WOL\newMACs.txt” del “c:\scripts\WOL\newMACs.txt”

    :: Query for MACs on 2 subnets
    for %%a in (22,23) do netsh -c dhcp server 10.10.%%a.25 scope 10.10.%%a.0 show clients | grep | sed s/-" "//g | sed s/." “//g | cut -d” " -f 2 | grep -Fvf macsDB.txt >> newMACs.txt

    type newMACs.txt >> macsDB.txt

    :: WOL - SUBNET 1
    for /f “tokens=* delims=” %%a in (macsDB.txt) do wolcmd %%a 7[/CODE]

    I have a scheduled task that runs the above script, but the essential part is the “netsh -c dhcp server <ip of dhcp server> <subnet> show clients”

    That should show you the current clients based on your lease time, run repeatedly (according to your lease time) to build up a list of valid macs.

  • There are a few ways around this problem. Prior to version 0.28 you could push the client software to the PC with AD using Group Policy and have it auto register.

    Now with that feature removed… at least I thought it was (the auto registration) we use spiceworks to scan our network, get the mac addresses and computer names over to a .csv (using their inventory feature) and import that into Fog.

  • From what i’ve heard before, this is not possible. AD doesn’t keep the records necessary to import them into the database. Really, all you need is a MAC address and the hostname, (but AD doesn’t store the MAC info). We used SCCM to generate a report with all the hostnames and mac address on our network. Though you might be able to find some software that can pull a report of everything on the network.