473,714 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Issue of changing IPAddress programatically in windows vista

1 New Member
My requirement is to change the IP Address of local system programatically using .net.
IP Address should change to 10.1.2.100, subnet mask = 255.255.255.0, default gateway=10.1.2. 1

I have created a small C# Console application in Visual Studio 2005 which change the IP address of the local system. I execute the following batch file using Process.Start(" ipchange1.bat") ;

Content of batch file is:

set path=c:\Windows \System32
netsh interface ip set address name="Local Area Connection" static 10.1.2.100 255.255.255.0 10.1.2.1 1

The above application is not working in Vista. It showed the error message as "The requested operation requires elevation".
To solve this error I added a new file to the project entitled ipApplication.e xe.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes "?>
<assembly xmlns="urn:sche mas-microsoft-com:asm.v1" manifestVersion ="1.0">
<assemblyIdenti ty version="1.0.0. 0" processorArchit ecture="X86" name="ipApplica tion" type="win32"/>
<trustInfo xmlns="urn:sche mas-microsoft-com:asm.v3">
<security>
<requestedPrivi leges>
<requestedExecu tionLevel level="requireA dministrator"/>
</requestedPrivil eges>
</security>
</trustInfo>
</assembly>

I embeded the manifest into my executable by adding the below code in Project Properties -> Build Events -> Post-build event command line

"$(DevEnvDir).. \..\SDK\v2.0\bi n\mt.exe" -manifest "$(ProjectDir)$ (TargetName).ex e.manifest" –outputresource :"$(TargetDir)$ (TargetFileName )";#1

when I click on the generated exe file in bin/Debug it is working fine, but I need to run this application at the end of the installation of a setup package. I added the exe file in Commit part of Custom Action.

At the end of installation I got an error 2869.

I solved the issue by getting help from this link:
http://hunter555.blogs pot.com/2007/02/installer-error-code-2869-msi-and-uac.html

The program is working fine at the end of installation but, It is changing the IP Address abnormally
The changed IP Address is 169.254.1.234, Subnet Mask=255.255.0. 0, Default Gateway=10.1.2. 1

I don't know how to proceed further can anyone guide me with the above issue or do anyone have an alternate solution??

Need your kind support

Thanks and Regards,
Raja.
Mar 6 '08 #1
1 1998
ownageseeker
1 New Member
can u do this for windows xp?
Apr 6 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1032
by: PHLICS_Admin | last post by:
Hi All, There are two network cards in one computer (named A) , and there is one network card in another computer(named B). On computer A: one network card is used to connect to internet, and the other network card is used in intranet whose ipaddress is 192.168.0.1 On computer B: the network card's ipaddress is 192.168.0.2. These two computer can connect to each other.
1
4703
by: Nick via .NET 247 | last post by:
I have a similar problem trying to use web services with awindows form application. I currently use a static web referencein my project. What I am trying to do is to programaticallychange the url based on a server name passed in, and whether ornot the PDA is in the active sync cradle. IE. If the PDA is in the cradle, use localhost. If the PDA isn'tin the cradle, then allow connection over wi-fi to any validwebservice by changing the computer...
0
971
by: Sisnaz | last post by:
I have 2 computers running with Windows Vista (final). One system where I upgraded from XP and the other as a fresh install. My executables run without issue on the system where I upgraded from XP. The other system gives me an error of Access Denied when it tries to run this code: If Process.GetCurrentProcess.ProcessName.ToLower() = "devenv" Then Exit Sub It appears the Process class is giving me grief on this Vista installation.
6
4275
by: j2ee.singh | last post by:
Hi, I'm looking to buy a new laptop primarily to learn & practice .NET and C#. My Question is: Is there any requirement for .NET and C# in terms of the following Operating Systems: - Windows Vista Home Basic - Windows Vista Business
2
2000
by: JamesB | last post by:
Hi all. I have a Winforms app that installs a service programatically (as opposed to using InstallUtil). If UAC on Vista is disabled, it works fine. Likewise, if the program is started by right-clicking and picking "Run as Administrator" it works (if UAC is enabled), but neither option is ideal. I suppose really I want UAC to pop up it's "do you want to allow this to happen" box when my code does its thing. Can anyone point me in the...
2
1902
by: Martin | last post by:
I have the following code being used in several of my PHP scripts (it's in an include file). It opens a socket connection to a process that's running on the same computer that IIS/PHP is running on. The OS is Windows XPPro. This all works fine - no problems. $portnum = 1001; $address = $_SERVER; $socket = @fsockopen($address, $portnum, $errno, $errstr, 2);
2
2644
by: Oriane | last post by:
With IIS7 on Vista SP1, the problem does not occur. When I told you yesterday that the problem occurs on Windows XP/Vista, I talked about the client environment.
0
1328
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, well i had no need for it until today, so how can i bring up the "Backup and Restore" Dialog in Vista? In W2K and XP its still ntbackup.exe but with vista it changed to something like a explorer call with some parameters like: C:\Windows\explorer.exe "C:\Windows\Explorer.exe" /separate,/idlist,:49284:4224,C:\Users\devteamkg
4
23857
by: JamTech | last post by:
The Script Resource and the Web Resource files are generating intermittent errors in my application. I have been trying to chase the cause of the problem but to no avail. I notice that the “d” parameter that is passed is some how corrupted and I can’t for the life of me figure out what’s causing this parameter to be corrupted. I noticed that JavaScript code that in my application is some how getting intertwined with the hash code that’s...
0
8801
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
9314
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...
1
9074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9015
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5947
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
4725
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3158
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
2520
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2110
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.