473,396 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Issue of changing IPAddress programatically in windows vista

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.exe.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="ipApplication" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator"/>
</requestedPrivileges>
</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\bin\mt.exe" -manifest "$(ProjectDir)$(TargetName).exe.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.blogspot.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 1978
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
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...
1
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...
0
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....
6
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: -...
2
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...
2
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...
2
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
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...
4
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”...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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...
0
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,...

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.