0

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.

KAPes
  • 994
  • 4
  • 12

1 Answers1

0

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           
            Err.Clear
            LCUser.Delete_

            'Do error checking here
        Next

        DeleteInstance = true

End Function
nimizen
  • 276
  • 3
  • 9