Anders,
Since I am not able to reproduce your issue with the code snippet you sent
me we may need to open a actual case for the issue since we may need to
look at more of your code.
Perhaps what you can do is just verify that the oSercher.Get is the source
of the delay. Can you add time stamp code in various places in the code. I
would like to see if the Delete() or the Get() is the problem. In addition
you could try to optimize the ManagementObjectSearcher by setting some
options and see if that makes any difference. I suspect it will not
though. For example:
//================================================================
ConnectionOptions oConn = new ConnectionOptions();
ManagementPath path = new ManagementPath();
path.Server = "storage";
path.NamespacePath = "root\\MicrosoftDNS";
ManagementScope scope = new ManagementScope();
scope.Options = oConn;
scope.Path = path;
scope.Connect();
ObjectQuery sQuery = new ObjectQuery();
sQuery.QueryLanguage = "WQL";
sQuery.QueryString = "SELECT * FROM MicrosoftDNS_Zone WHERE ContainerName =
'MikeZone' AND Name='MikeZone'";
EnumerationOptions options = new EnumerationOptions();
options.ReturnImmediately = true;
options.Rewindable = false;
options.EnumerateDeep = false;
ManagementObjectSearcher oSearcher = new ManagementObjectSearcher();
oSearcher.Scope = scope;
oSearcher.Query = sQuery;
oSearcher.Options = options;
ManagementObjectCollection oCollection = oSearcher.Get();
//================================================================
Mike Dutra
Microsoft Developer Support WSH/WMI/Cluster Dev
Disclaimer: This posting is provided "AS IS" with no warranties, and
confers no rights. You assume all risk for your use.
--------------------