Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. Issue in changing IP Address programatcally using VS 2005 in Vista

Issue in changing IP Address programatcally using VS 2005 in Vista

Scheduled Pinned Locked Moved Windows API
csharphelpvisual-studiotutorialhtml
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 3650608
    wrote on last edited by
    #1

    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 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?? Thanks in Advance, Raja.

    U 1 Reply Last reply
    0
    • U User 3650608

      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 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?? Thanks in Advance, Raja.

      U Offline
      U Offline
      User 3650608
      wrote on last edited by
      #2

      I am sorry the xml file for ipApplication.exe.manifest is <?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>

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups