469,964 Members | 1,731 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

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, subnet mask =, default gateway=

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 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="" processorArchitecture="X86" name="ipApplication" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator"/>

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:

The program is working fine at the end of installation but, It is changing the IP Address abnormally
The changed IP Address is, Subnet Mask=, Default Gateway=

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,
Mar 6 '08 #1
1 1826
can u do this for windows xp?
Apr 6 '08 #2

Post your reply

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

Similar topics

reply views Thread by PHLICS_Admin | last post: by
1 post views Thread by Nick via .NET 247 | last post: by
2 posts views Thread by Martin | last post: by
2 posts views Thread by Oriane | last post: by
reply views Thread by =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.