Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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.