We will shortly be moving all our user accounts to a new domain, as part of this the user accounts will pick up new SMS ResourceIDs in SCCM.
What I need to do is to query SCCM for all collections that a user is a member of, so that I can duplicate those for the new user account, Direct Memberships (rather than query memberships) are what I'm interested in. It seems to be pretty easy to find all adverts to a user, but not to find their collections.
Ideally I'd like to be able to get this via a script so that I can then use a second script to add the new user account to the relevant collections (already able to add to collections via a script).
Currently running SCCM 2007 R2.
Ok, after more MSDN reading than I ever care to do again, here's (a messy) VBScript that I managed to pull together to pull the relevant out of SCCM: