I have the following code and if I enter the name of a computer running
under windows xp I get an exception that rpc server is not available
although the services are running
void userGroups(string computerName)
string compName = computerName;
if (!compName.StartsWith(@"\\"))
{
compName = @"\\" + compName + @"\root\cimv2";
}
ConnectionOptions options = new ConnectionOptions();
options.Username = this.userName;
options.Password = this.password;
ManagementScope mScope = new ManagementScope(compName, options);
string domain = "";
try
{
ManagementObjectSearcher searcher = new
ManagementObjectSearcher(mScope,new ObjectQuery("SELECT * FROM
Win32_Group where Domain
= '" + computerName + "'"));
ManagementObjectSearcher searcher2 = new
ManagementObjectSearcher(mScope,new ObjectQuery("SELECT Name FROM
Win32_UserAccount where
Domain = '" + computerName + "'"));
ManagementObjectCollection moc = searcher.Get(); //***
//by *** jump into the exception
ManagementObjectCollection moc2 = searcher2.Get();
ManagementBaseObject[] names = new ManagementBaseObject
[moc2.Count];
ManagementBaseObject[] groups = new ManagementBaseObject
[moc.Count];
moc2.CopyTo(names, 0);
moc.CopyTo(groups, 0);
domain = groups[0]["Domain"].ToString();
for (int i = 0; i < groups.Length; i++)
{
if (i < names.Length)
{
string name = names[i]["Name"].ToString();
this.listBoxBenutzername.Items.Add(name);
}
this.listBoxRechner.Items.Add(domain);
string group = groups[i]["Name"].ToString();
this.listBoxGruppe.Items.Add(group);
}
}
}
catch (Exception ex)
{
throw new Exception("Error obtaining group names. " +
ex.Message);
}
}
---------------------------------------------
An this point, see //***
I get the exception: "RPC Server is unavailable from HRESULT:
0x800706BA"
Is there anything I am missing?
Thanks in advance 4 7503
By default, XP and higer OS do not enable "external" access of WMI services.
You'll have to set each PC's WMI security according your requirements.
Willy.
"Stropher" <hm***@gmx.netwrote in message
news:11********************@v61g2000cwv.googlegrou ps.com...
|I have the following code and if I enter the name of a computer running
| under windows xp I get an exception that rpc server is not available
| although the services are running
|
| void userGroups(string computerName)
|
| string compName = computerName;
| if (!compName.StartsWith(@"\\"))
| {
| compName = @"\\" + compName + @"\root\cimv2";
| }
| ConnectionOptions options = new ConnectionOptions();
|
| options.Username = this.userName;
| options.Password = this.password;
|
| ManagementScope mScope = new ManagementScope(compName, options);
| string domain = "";
| try
| {
| ManagementObjectSearcher searcher = new
| ManagementObjectSearcher(mScope,new ObjectQuery("SELECT * FROM
| Win32_Group where Domain
| = '" + computerName + "'"));
| ManagementObjectSearcher searcher2 = new
| ManagementObjectSearcher(mScope,new ObjectQuery("SELECT Name FROM
| Win32_UserAccount where
| Domain = '" + computerName + "'"));
|
| ManagementObjectCollection moc = searcher.Get(); //***
| //by *** jump into the exception
| ManagementObjectCollection moc2 = searcher2.Get();
|
| ManagementBaseObject[] names = new ManagementBaseObject
| [moc2.Count];
| ManagementBaseObject[] groups = new ManagementBaseObject
| [moc.Count];
| moc2.CopyTo(names, 0);
| moc.CopyTo(groups, 0);
|
| domain = groups[0]["Domain"].ToString();
|
| for (int i = 0; i < groups.Length; i++)
| {
| if (i < names.Length)
| {
| string name = names[i]["Name"].ToString();
| this.listBoxBenutzername.Items.Add(name);
| }
|
| this.listBoxRechner.Items.Add(domain);
| string group = groups[i]["Name"].ToString();
| this.listBoxGruppe.Items.Add(group);
|
| }
| }
| }
| catch (Exception ex)
| {
| throw new Exception("Error obtaining group names. " +
| ex.Message);
| }
| }
|
| ---------------------------------------------
| An this point, see //***
| I get the exception: "RPC Server is unavailable from HRESULT:
| 0x800706BA"
|
| Is there anything I am missing?
| Thanks in advance
|
Make sure the firewall isn't blocking it.
Also, you need to set an additional option. Since sp1, it has been
required to use PacketPrivacy when authenticating against remote
machines. You just need to set an additional ConnectionOption. In you
code, add:
options.Authentication = AuthenticationLevel.PacketPrivacy;
You should also be aware of the behavior that RPC uses dynamic port
allocation. I don't know if this is the case for XP boxes, but if you
ever want to do what you're doing to a server, you will probably need
to know this: http://support.microsoft.com/kb/154596/EN-US/
On 4 Jul 2006 02:46:57 -0700, "Stropher" <hm***@gmx.netwrote:
>I have the following code and if I enter the name of a computer running under windows xp I get an exception that rpc server is not available although the services are running
void userGroups(string computerName)
string compName = computerName;
if (!compName.StartsWith(@"\\"))
{
compName = @"\\" + compName + @"\root\cimv2";
}
ConnectionOptions options = new ConnectionOptions();
options.Username = this.userName;
options.Password = this.password;
ManagementScope mScope = new ManagementScope(compName, options);
string domain = "";
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher(mScope,new ObjectQuery("SELECT * FROM Win32_Group where Domain
= '" + computerName + "'"));
ManagementObjectSearcher searcher2 = new ManagementObjectSearcher(mScope,new ObjectQuery("SELECT Name FROM Win32_UserAccount where
Domain = '" + computerName + "'"));
ManagementObjectCollection moc = searcher.Get(); //***
//by *** jump into the exception
ManagementObjectCollection moc2 = searcher2.Get();
ManagementBaseObject[] names = new ManagementBaseObject
[moc2.Count];
ManagementBaseObject[] groups = new ManagementBaseObject
[moc.Count];
moc2.CopyTo(names, 0);
moc.CopyTo(groups, 0);
domain = groups[0]["Domain"].ToString();
for (int i = 0; i < groups.Length; i++)
{
if (i < names.Length)
{
string name = names[i]["Name"].ToString();
this.listBoxBenutzername.Items.Add(name);
}
this.listBoxRechner.Items.Add(domain);
string group = groups[i]["Name"].ToString();
this.listBoxGruppe.Items.Add(group);
}
}
}
catch (Exception ex)
{
throw new Exception("Error obtaining group names. " +
ex.Message);
}
}
--------------------------------------------- An this point, see //*** I get the exception: "RPC Server is unavailable from HRESULT: 0x800706BA"
Is there anything I am missing? Thanks in advance
Thanks very much for your quick answer..
Willy Denoyette [MVP] wrote:
By default, XP and higer OS do not enable "external" access of WMI services.
You'll have to set each PC's WMI security according your requirements.
Willy.
"Stropher" <hm***@gmx.netwrote in message
news:11********************@v61g2000cwv.googlegrou ps.com...
|I have the following code and if I enter the name of a computer running
| under windows xp I get an exception that rpc server is not available
| although the services are running
|
| void userGroups(string computerName)
|
| string compName = computerName;
| if (!compName.StartsWith(@"\\"))
| {
| compName = @"\\" + compName + @"\root\cimv2";
| }
| ConnectionOptions options = new ConnectionOptions();
|
| options.Username = this.userName;
| options.Password = this.password;
|
| ManagementScope mScope = new ManagementScope(compName, options);
| string domain = "";
| try
| {
| ManagementObjectSearcher searcher = new
| ManagementObjectSearcher(mScope,new ObjectQuery("SELECT * FROM
| Win32_Group where Domain
| = '" + computerName + "'"));
| ManagementObjectSearcher searcher2 = new
| ManagementObjectSearcher(mScope,new ObjectQuery("SELECT Name FROM
| Win32_UserAccount where
| Domain = '" + computerName + "'"));
|
| ManagementObjectCollection moc = searcher.Get(); //***
| //by *** jump into the exception
| ManagementObjectCollection moc2 = searcher2.Get();
|
| ManagementBaseObject[] names = new ManagementBaseObject
| [moc2.Count];
| ManagementBaseObject[] groups = new ManagementBaseObject
| [moc.Count];
| moc2.CopyTo(names, 0);
| moc.CopyTo(groups, 0);
|
| domain = groups[0]["Domain"].ToString();
|
| for (int i = 0; i < groups.Length; i++)
| {
| if (i < names.Length)
| {
| string name = names[i]["Name"].ToString();
| this.listBoxBenutzername.Items.Add(name);
| }
|
| this.listBoxRechner.Items.Add(domain);
| string group = groups[i]["Name"].ToString();
| this.listBoxGruppe.Items.Add(group);
|
| }
| }
| }
| catch (Exception ex)
| {
| throw new Exception("Error obtaining group names. " +
| ex.Message);
| }
| }
|
| ---------------------------------------------
| An this point, see //***
| I get the exception: "RPC Server is unavailable from HRESULT:
| 0x800706BA"
|
| Is there anything I am missing?
| Thanks in advance
|
Thanks Jeff for your reply...
Jeff Shepler wrote:
Make sure the firewall isn't blocking it.
Also, you need to set an additional option. Since sp1, it has been
required to use PacketPrivacy when authenticating against remote
machines. You just need to set an additional ConnectionOption. In you
code, add:
options.Authentication = AuthenticationLevel.PacketPrivacy;
You should also be aware of the behavior that RPC uses dynamic port
allocation. I don't know if this is the case for XP boxes, but if you
ever want to do what you're doing to a server, you will probably need
to know this:
http://support.microsoft.com/kb/154596/EN-US/
On 4 Jul 2006 02:46:57 -0700, "Stropher" <hm***@gmx.netwrote:
I have the following code and if I enter the name of a computer running
under windows xp I get an exception that rpc server is not available
although the services are running
void userGroups(string computerName)
string compName = computerName;
if (!compName.StartsWith(@"\\"))
{
compName = @"\\" + compName + @"\root\cimv2";
}
ConnectionOptions options = new ConnectionOptions();
options.Username = this.userName;
options.Password = this.password;
ManagementScope mScope = new ManagementScope(compName, options);
string domain = "";
try
{
ManagementObjectSearcher searcher = new
ManagementObjectSearcher(mScope,new ObjectQuery("SELECT * FROM
Win32_Group where Domain
= '" + computerName + "'"));
ManagementObjectSearcher searcher2 = new
ManagementObjectSearcher(mScope,new ObjectQuery("SELECT Name FROM
Win32_UserAccount where
Domain = '" + computerName + "'"));
ManagementObjectCollection moc = searcher.Get(); //***
//by *** jump into the exception
ManagementObjectCollection moc2 = searcher2.Get();
ManagementBaseObject[] names = new ManagementBaseObject
[moc2.Count];
ManagementBaseObject[] groups = new ManagementBaseObject
[moc.Count];
moc2.CopyTo(names, 0);
moc.CopyTo(groups, 0);
domain = groups[0]["Domain"].ToString();
for (int i = 0; i < groups.Length; i++)
{
if (i < names.Length)
{
string name = names[i]["Name"].ToString();
this.listBoxBenutzername.Items.Add(name);
}
this.listBoxRechner.Items.Add(domain);
string group = groups[i]["Name"].ToString();
this.listBoxGruppe.Items.Add(group);
}
}
}
catch (Exception ex)
{
throw new Exception("Error obtaining group names. " +
ex.Message);
}
}
---------------------------------------------
An this point, see //***
I get the exception: "RPC Server is unavailable from HRESULT:
0x800706BA"
Is there anything I am missing?
Thanks in advance
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: lumazi |
last post by:
Hello all,
I'm having an issue printing to a network printer. The line of code
is fairly simple
printDocument1.Print();
When you select print from a local printer it works fine, when you...
|
by: shahzad |
last post by:
i get thius error msg when i run my aspx page
Server Application Unavailable
The web application you are attempting to access on this
web server is currently unavailable. Please hit
the...
|
by: David Walker |
last post by:
Hi, I've encountered a problem when installing the .Net framework
version 1.0 on a Windows 2000 Server machine in a clustered
environment. After I install the framework and try to run a simple...
|
by: robby valles |
last post by:
My company has a large windows form app with the datalayer being
webservices. pretty randomly the webservice calls will either be very
slow or i'll get the server unavailable. there are times when...
|
by: Steven Babb |
last post by:
I have taken over responsibilities for a .NET app that runs on IIS Server
locally and has a user that has a local Access database that launches the app
from a URL. They are receiveing the following...
|
by: pphadke |
last post by:
I have an application that was originally in asp but is now moved to
ASP.Net. To deploy it, I just changed the default file in IIS for the
web folder to point to the new aspx file. Occasionally I...
|
by: Jon B |
last post by:
Hi All!
I have a ASP.NET 2.0 site that works on the Windows 2000 Server. However,
when I tried to view this site on my local Windows XP machine, I get "Server
Unavailable". If I switch the...
|
by: ruca |
last post by:
Hi,
My WebApp not stoping to give me this error
SERVER APPLICATION UNAVAILABLE
aspnet_wp.exe could not be started. The error code for the failure is
80004005. This error can be caused...
|
by: ciffycyclops |
last post by:
Hello..
i am using WIndows XP Professional service pack 2 in my client m/c as well as in server..i diasabled the firewall in both the local and remote computer..but it shows the following error"RPC...
|
by: kenski |
last post by:
Hello,
I'm new here hopefully i did not broke any rules already, Here's the problem, I'm getting the OUT OF MEMORY exception/SERVER UNAVAILABLE error when fetching large amounts of data in the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |