public static SearchSession BeginSearch(this PSCmdlet cmdlet, bool force, string criterea) { IUpdateService2 service = cmdlet.GetService(force); UpdateSession updateSession = new UpdateSession(); IUpdateSearcher2 searcher = updateSession.CreateSearcher(); searcher.ServerSelection = ServerSelection.ssOthers; searcher.ServiceID = service.ServiceID; SearchCompletedCallback callback = new SearchCompletedCallback(searcher); object state = new object(); searcher.BeginSearch(criterea, callback, state); return(new SearchSession(callback)); }