Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
Questionquery on data columns Pin
dvsr19-Jan-06 7:04
dvsr19-Jan-06 7:04 
AnswerRe: query on data columns Pin
vineas19-Jan-06 7:24
vineas19-Jan-06 7:24 
GeneralRe: query on data columns Pin
dvsr19-Jan-06 12:15
dvsr19-Jan-06 12:15 
AnswerRe: query on data columns Pin
Wjousts19-Jan-06 9:49
Wjousts19-Jan-06 9:49 
GeneralRe: query on data columns Pin
dvsr19-Jan-06 10:01
dvsr19-Jan-06 10:01 
QuestionHow to wrapp .net 3rdparty controls with designer support? Pin
Chris Richner19-Jan-06 7:04
Chris Richner19-Jan-06 7:04 
Questionslideshow viewer Pin
GetSharp19-Jan-06 6:47
GetSharp19-Jan-06 6:47 
QuestionHow to check if 'RPC server is available' on a remote computer. Pin
ESTAN19-Jan-06 6:38
ESTAN19-Jan-06 6:38 
Hello guys,

I am having here some problems regarding pc's where the RPC server is not running or pc's where the windows firewall is causing my program to crash.

I am doing some inventories with WMI queries. Most of them it is not a problem, but there are PC's were the windows firewall is on and giving me the following error (from the log file):

DISCOVERY Error, sComputerType, System.Runtime.InteropServices.COMException: De RPC-server is niet beschikbaar. (Exception from HRESULT: 0x800706BA)

After 4 of this errors my program quits, altought that I am using Try Catch.

Is there a way to check if the 'RPC server is available' prior to the inventory process?

Thanks in advance.

The code for your info:

<br />
public static string GetInfoWithWMI(string _sComputerName, string _sParameter, string _sObjName, string _sObjQuery)<br />
{<br />
	string sComputerName = _sComputerName;<br />
	string sParameter = _sParameter;<br />
	string sObjName = _sObjName;<br />
	string sObjQuery = _sObjQuery;<br />
	string sValue = "";<br />
<br />
	try<br />
	{<br />
		ManagementScope scope = new ManagementScope("\\\\" + sComputerName + "\\root\\CIMV2");<br />
		scope.Connect();<br />
		ObjectQuery query = new ObjectQuery(sObjQuery);<br />
		ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);<br />
<br />
		foreach (ManagementObject queryObj in searcher.Get())<br />
		{<br />
			if (queryObj[sObjName] != null)<br />
				sValue = queryObj[sObjName].ToString();<br />
		}<br />
		// Logging<br />
		if (Program._LoggingEnabled == "Y" && Program._LogDiscoveryProcess == "Y")<br />
			Program.LogInfo("Discovery process: object=" + sComputerName + ", " + sParameter + "=" + sValue, 1);<br />
		return sValue;<br />
	}<br />
	catch (System.Management.ManagementException mex)<br />
	{<br />
		<br />
		// Logging<br />
		if (Program._LoggingEnabled == "Y" && (Program._LogDiscoveryProcess == "Y" || Program._LogProgramErrors == "Y"))<br />
			Program.LogInfo("DISCOVERY Error, " + sParameter + ", System.Management.ManagementException: " + mex.Message, 3);<br />
	}<br />
	catch (System.Runtime.InteropServices.COMException comex)<br />
	{<br />
		// Logging<br />
		if (Program._LoggingEnabled == "Y" && (Program._LogDiscoveryProcess == "Y" || Program._LogProgramErrors == "Y"))<br />
			Program.LogInfo("DISCOVERY Error, " + sParameter + ", System.Runtime.InteropServices.COMException: " + comex.Message, 3);<br />
	}<br />
	catch (System.Exception ex)<br />
	{<br />
		// Logging<br />
		if (Program._LoggingEnabled == "Y" && (Program._LogDiscoveryProcess == "Y" || Program._LogProgramErrors == "Y"))<br />
			Program.LogInfo("DISCOVERY Error, " + sParameter + ", System.Exception: " + ex.Message, 3);<br />
	}<br />
<br />
return "";<br />
}<br />

AnswerRe: How to check if 'RPC server is available' on a remote computer. Pin
ESTAN19-Jan-06 22:15
ESTAN19-Jan-06 22:15 
QuestionClass Library DLL with no functions Pin
uNsignedINT19-Jan-06 6:11
uNsignedINT19-Jan-06 6:11 
AnswerRe: Class Library DLL with no functions Pin
malharone19-Jan-06 6:19
malharone19-Jan-06 6:19 
GeneralRe: Class Library DLL with no functions Pin
uNsignedINT19-Jan-06 6:26
uNsignedINT19-Jan-06 6:26 
GeneralRe: Class Library DLL with no functions Pin
malharone19-Jan-06 6:49
malharone19-Jan-06 6:49 
GeneralRe: Class Library DLL with no functions Pin
uNsignedINT19-Jan-06 7:10
uNsignedINT19-Jan-06 7:10 
GeneralRe: Class Library DLL with no functions Pin
uNsignedINT19-Jan-06 7:57
uNsignedINT19-Jan-06 7:57 
GeneralRe: Class Library DLL with no functions Pin
Dave Kreskowiak19-Jan-06 10:32
mveDave Kreskowiak19-Jan-06 10:32 
Questionstring to richtext format Pin
Agyeman19-Jan-06 6:00
Agyeman19-Jan-06 6:00 
AnswerRe: string to richtext format Pin
malharone19-Jan-06 6:21
malharone19-Jan-06 6:21 
GeneralRe: string to richtext format Pin
Dario Solera19-Jan-06 6:41
Dario Solera19-Jan-06 6:41 
GeneralRe: string to richtext format Pin
malharone19-Jan-06 6:56
malharone19-Jan-06 6:56 
GeneralRe: string to richtext format Pin
lmoelleb19-Jan-06 20:44
lmoelleb19-Jan-06 20:44 
QuestionDisplaying time of Two Countries?? Pin
Harish Krishnan19-Jan-06 5:49
Harish Krishnan19-Jan-06 5:49 
AnswerRe: Displaying time of Two Countries?? Pin
malharone19-Jan-06 6:21
malharone19-Jan-06 6:21 
AnswerRe: Displaying time of Two Countries?? Pin
Andy Moore19-Jan-06 6:41
Andy Moore19-Jan-06 6:41 
Questionhow create multi Selection reusult Pin
Sasuko19-Jan-06 4:47
Sasuko19-Jan-06 4:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.