Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for programatically removing user accounts from OCS 2007 R2.

I would prefer vbscript solution as this will become part of larger deprovisioning script used for removing various user related stuff across applications.

share|improve this question

Found the code below in the MSDN documentation here; does this serve your purposes?

    Public Function DeleteInstance(UserURI)

        ' Connect to WMI server

        Set wmiServer = CreateObject("WbemScripting.SWbemLocator").ConnectServer()

        'Do error checking here

        Query = "SELECT * FROM MSFT_SIPESUserSetting where PrimaryURI = '" & UserURI & "'"

        Set LCUserEnum = wmiServer.ExecQuery(Query)

        For each LCUser in LCUserEnum           

            'Do error checking here

        DeleteInstance = true

End Function
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.