I have a AD hosted on 2003R2 and 2008R2, I would like to check the membership for the domain computer (e.g. compA) when an user logs on using that computer (e.g. compA) and perform certain operations inside a script. I think WMI could probably be useful but I am unable to find the proper query to get the list of groups of the computer account in question. Any idea?
Get-WmiObject win32_ComputerSystem | Format-List DomainRole
Here's a script that I've modified from this site. I haven't tested the code, but it looks sound.
This should get you going in the right direction if you haven't solved it by now.