I have next code:
private ManagementGroup ConnectToManagementGroup(string serverName, string domain, string userName, string password)
{
var settings = new ManagementGroupConnectionSettings(serverName)
{
UserName = userName,
Domain = domain,
Password = password.ToSecureString()
};
var managementGroup = ManagementGroup.Connect(settings);
if (!managementGroup.IsConnected)
{
throw new Exception($"Can't connect to {serverName} SDK service.");
}
return managementGroup;
}
The code works fine.
But if my SCOM server is down then connection takes one minute before throwing a TimeOut
exception.
I have found two properties InactivityTimeout
and SendReceiveTimeout
in ManagementGroupConnectionSettings
class.
I have tried to use these properties to change default TimeOut
value.
But unfortunately it doesn't work.
Also I can't find any documentations about connection TimeOut
for SCOM SDK.
I have reviewed many links: here, here and here...
But there was no answer for my issue...
How can I set TimeOut for connection myself?