Snapins with info from FOG

  • Testers

    I have been doing some searching but am not sure how to query the fog database on a local computer to user in a snapin. I would like to have a snap in that will check the FOG database and set the primary user as an admin. I can do scripts and snapins just fine. But when it comes to PHP and sql queries I am a complete novice. So far I run the following command to add my techs to the local admin group.

    net localgroup administrators "Domain\Tech Dept" /add

    But I was wondering if someone could help me figure out how to query the database and get the Primary user field and use it to add a user to the local admin group? Any help would be greatly appreciated.

  • Testers

    @Wayne-Workman Thanks for that pointer, that will definitely help in getting started in this. I am learning how to do simple sql queries in PS and VBscript to try and accomplish this but none of them would work without this part.

  • @ITSolutions In order to do any sort of remote query, you have to enable remote access to the DB. There’s a wiki article explaining how to do that here:

    I’d strongly advise you to create a brand new account on the fog server for this, and give that account read-only access to the DB.