473,663 Members | 2,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error in a WMI Method

Hi, I was implementing in a program WinForm write in C# a method that change
the DNS Sufix of networkcard of PC, well I search in the .NET documenttion
and I found a class that allow this feature, the class
"Win32_NetworkA dapterConfigura tion" with the method "SetDNSSuffixSe archOrder"
that receive when argument the string array "DNSDomainSuffi xSearchOrder[]"
that it would have to be the new suffix. I write in code this implemetation
but I ever receive a error when it tries to change the suffix. My code is:

using System.Manageme nt;
public static void SetaSufixo()
{
ManagementClass suffix = new
ManagementClass ("Win32_Network AdapterConfigur ation");

ManagementBaseO bject newSuffix =
suffix.GetMetho dParameters("Se tDNSSuffixSearc hOrder");

newSuffix ["DNSDomainSuffi xSearchOrder"] = "any value";

suffix.InvokeMe thod ("SetDNSSuffixS earchOrder", newSuffix, null);

}

Somepeople has a ideia of as I I decide this problem?

Sorry my english =(

Tks

Bruno
--
C# .NET Developer
Nov 17 '05 #1
3 3827

"Bruno Renato" <Br*********@di scussions.micro soft.com> wrote in message
news:59******** *************** ***********@mic rosoft.com...
Hi, I was implementing in a program WinForm write in C# a method that
change
the DNS Sufix of networkcard of PC, well I search in the .NET documenttion
and I found a class that allow this feature, the class
"Win32_NetworkA dapterConfigura tion" with the method
"SetDNSSuffixSe archOrder"
that receive when argument the string array "DNSDomainSuffi xSearchOrder[]"
that it would have to be the new suffix. I write in code this
implemetation
but I ever receive a error when it tries to change the suffix. My code is:

using System.Manageme nt;
public static void SetaSufixo()
{
ManagementClass suffix = new
ManagementClass ("Win32_Network AdapterConfigur ation");

ManagementBaseO bject newSuffix =
suffix.GetMetho dParameters("Se tDNSSuffixSearc hOrder");

newSuffix ["DNSDomainSuffi xSearchOrder"] = "any value";

suffix.InvokeMe thod ("SetDNSSuffixS earchOrder", newSuffix, null);

}

Somepeople has a ideia of as I I decide this problem?

Sorry my english =(

Tks

Bruno
--
C# .NET Developer


The "DNSDomainSuffi xSearchOrder" property must be an array of strings!

Willy.
Nov 17 '05 #2
But when I implement this in the code?? I tried to use thus but also he did
not give certain:

newSuffix[1] ["DNSDomainSuffi xSearchOrder"] = "any value";

or
string [] valor = new string [2];
valor[0] = "test";
newSuffix ["DNSDomainSuffi xSearchOrder"] = "valor";

Which is the correct form?

Tks

Bruno Renato.
C# .NET Developer
"Willy Denoyette [MVP]" wrote:

"Bruno Renato" <Br*********@di scussions.micro soft.com> wrote in message
news:59******** *************** ***********@mic rosoft.com...
Hi, I was implementing in a program WinForm write in C# a method that
change
the DNS Sufix of networkcard of PC, well I search in the .NET documenttion
and I found a class that allow this feature, the class
"Win32_NetworkA dapterConfigura tion" with the method
"SetDNSSuffixSe archOrder"
that receive when argument the string array "DNSDomainSuffi xSearchOrder[]"
that it would have to be the new suffix. I write in code this
implemetation
but I ever receive a error when it tries to change the suffix. My code is:

using System.Manageme nt;
public static void SetaSufixo()
{
ManagementClass suffix = new
ManagementClass ("Win32_Network AdapterConfigur ation");

ManagementBaseO bject newSuffix =
suffix.GetMetho dParameters("Se tDNSSuffixSearc hOrder");

newSuffix ["DNSDomainSuffi xSearchOrder"] = "any value";

suffix.InvokeMe thod ("SetDNSSuffixS earchOrder", newSuffix, null);

}

Somepeople has a ideia of as I I decide this problem?

Sorry my english =(

Tks

Bruno
--
C# .NET Developer


The "DNSDomainSuffi xSearchOrder" property must be an array of strings!

Willy.

Nov 17 '05 #3

"Bruno Renato" <Br*********@di scussions.micro soft.com> wrote in message
news:44******** *************** ***********@mic rosoft.com...
But when I implement this in the code?? I tried to use thus but also he
did
not give certain:

newSuffix[1] ["DNSDomainSuffi xSearchOrder"] = "any value";

or
string [] valor = new string [2];
valor[0] = "test";
newSuffix ["DNSDomainSuffi xSearchOrder"] = "valor";

Which is the correct form?

Tks

Bruno Renato.
C# .NET Developer


Make it...
string [] valor = new string [1];
valor[0] = "test";
newSuffix ["DNSDomainSuffi xSearchOrder"] = valor;
or:
newSuffix ["DNSDomainSuffi xSearchOrder"] = new string [1] {"Test"};

Willy.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2927
by: josh dismukes | last post by:
/// here is the code i'm getting a parse error on the last line of the code which /// is </html> any help will be much appreciated. <?php session_start ();
2
6094
by: John F Dutcher | last post by:
Can anyone comment on why the code shown in the Python error is in some way incorrect...or is there a problem with Python on my hoster's site ?? The highlites don't seem to show here...but line #80 and line # 38 are the first line offenders. --> --> -->
2
4733
by: Fuzzyman | last post by:
I've written a CGI proxy that remotely fetches web pages. I use the urlopen function in CLientCookie which replaces (and ultimately uses) the urlopen function in urllib2. What I'd like to do is give a more useful message to the user when the page fetch fails. My understanding was that a URLError exception had a 'code' attribute which was the error code. I trap the error with a simple : (excuse the horrible indentation, this is from...
102
5649
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler can't tell where a bracket is missing.... a few weeks have past, I requested a feature for the delphi ide/editor "automatic identation of code in begin/end statements etc" and today when I woke up I suddenly released a very simple solution for this...
8
2422
by: Tom | last post by:
Hi I have an aspx page which has javascript to configure xmldata. I added breakpoint to the button method. When I click submit button, it did not go to those breakpoint and show the following error System.Web.HttpRequestValidationException (0x80004005) Detect the potential danger of Request.Form value from client side (idHidxml="<recordset><record><...") System.Web.HttpRequest.ValidateString(String s, String valueName, String...
8
9449
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As System.Security.Principal.WindowsImpersonationContext Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
10
2282
by: Anthony England | last post by:
(sorry for the likely repost, but it is still not showing on my news server and after that much typing, I don't want to lose it) I am considering general error handling routines and have written a sample function to look up an ID in a table. The function returns True if it can find the ID and create a recordset based on that ID, otherwise it returns false. **I am not looking for comments on the usefulness of this function - it is
0
23483
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub) 5: Procedure call or argument is not valid. 6: Overflow. 7: Out of memory.
5
1733
by: csgraham74 | last post by:
Hi guys, Basically i have been developing in dotnet for a couple of years but ive had a few issues in regards to error handling. For example - I have a class that i call passing in a stored procedure and connection string as a path. My method returns a dataset. In my SP i have an output parameter which tells me whether the SP select is successful or not. If i get a error code passed back then i throw an exception this then returns...
0
8435
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.