Remove network connection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jonas

    Remove network connection

    I want to remove a remote access connection when a user logs out. The
    connection is a dial up isdn adapter.

    I can access the adapter via WMI namespace \root\microsoft \homenet, but i
    don´t find any way to delete it.

    Is it possible to do this or do i need to some pinvoke on rasapi32?


  • Charles Wang[MSFT]

    #2
    RE: Remove network connection

    Hi,
    I'm sorry that I am not sure if you want to close the connection or delete
    an entry when a user logs out. Could you please lighten me more on your
    issue?

    Anyway, according to my experiences, RAS API is required on this issue and
    the P/Invoke technology provides the appropriate way on .NET platform.

    Firstly, you can use RasEnumConnecti ons to emumerate all the available
    active RAS connections handles on your system; Then use RasHangup to close
    the connection by the handle.
    If you wanted to delete the entry, please use RasEnumEntries to retrieve
    the available entries, then use RasDeleteEntry to delete the entry.

    For the RAS API references, please refer to:
    Remote Access Service Functions

    as_start_page.a sp

    Please feel free to let me know if you need further research on this issue.
    It's my pleasure to be of assistance.

    Sincerely yours,
    Charles Wang
    Microsoft Online Community Support

    =============== =============== =============== =========
    When responding to posts, please "Reply to Group" via
    your newsreader so that others may learn and benefit
    from this issue.
    =============== =============== =============== =========
    This posting is provided "AS IS" with no warranties, and confers no rights.
    =============== =============== =============== =========


    Comment

    • Jonas

      #3
      Re: Remove network connection

      Hi.

      I want to delete the connection.

      I will try with the RasDeleteEntry, do you know any way to accomplish this
      via WMI?

      "Charles Wang[MSFT]" <changliw@onlin e.microsoft.com wrote in message
      news:ymIQgoA9GH A.5376@TK2MSFTN GXA01.phx.gbl.. .
      Hi,
      I'm sorry that I am not sure if you want to close the connection or delete
      an entry when a user logs out. Could you please lighten me more on your
      issue?
      >
      Anyway, according to my experiences, RAS API is required on this issue
      and
      the P/Invoke technology provides the appropriate way on .NET platform.
      >
      Firstly, you can use RasEnumConnecti ons to emumerate all the available
      active RAS connections handles on your system; Then use RasHangup to close
      the connection by the handle.
      If you wanted to delete the entry, please use RasEnumEntries to retrieve
      the available entries, then use RasDeleteEntry to delete the entry.
      >
      For the RAS API references, please refer to:
      Remote Access Service Functions

      as_start_page.a sp
      >
      Please feel free to let me know if you need further research on this
      issue.
      It's my pleasure to be of assistance.
      >
      Sincerely yours,
      Charles Wang
      Microsoft Online Community Support
      >
      =============== =============== =============== =========
      When responding to posts, please "Reply to Group" via
      your newsreader so that others may learn and benefit
      from this issue.
      =============== =============== =============== =========
      This posting is provided "AS IS" with no warranties, and confers no
      rights.
      =============== =============== =============== =========
      >
      >

      Comment

      • Charles Wang[MSFT]

        #4
        Re: Remove network connection

        Hi,
        Thanks for your response.
        Please forgive my confusion regarding your saying "delete the connection",
        because generally we say that close a connection or disable a connection.
        Did you mean that?

        Unfortunately WMI is not designed to be able to disable a network
        connection.
        From this article,

        /wmi_tasks__netw orking.asp
        we can see that:
        If you're using DHCP, you can use the Win32_NetworkAd apterConfigurat ion and
        the ReleaseDHCPLeas e method to release the IP address. If you are not using
        DHCP, you cannot use WMI to disable a network connection.

        If you have any other questions or concerns, please feel free to let me
        know. It is my pleasure to be of assistance.

        Charles Wang
        Microsoft Online Community Support

        =============== =============== =============== =========
        When responding to posts, please "Reply to Group" via
        your newsreader so that others may learn and benefit
        from this issue.
        =============== =============== =============== =========
        This posting is provided "AS IS" with no warranties, and confers no rights.
        =============== =============== =============== =========




        Comment

        • Jonas

          #5
          Re: Remove network connection

          I solved it with the rasapi32.dll.

          Regards Jonas

          "Charles Wang[MSFT]" <changliw@onlin e.microsoft.com wrote in message
          news:10RldgC9GH A.6100@TK2MSFTN GXA01.phx.gbl.. .
          Hi,
          Thanks for your response.
          Please forgive my confusion regarding your saying "delete the connection",
          because generally we say that close a connection or disable a connection.
          Did you mean that?
          >
          Unfortunately WMI is not designed to be able to disable a network
          connection.
          From this article,

          /wmi_tasks__netw orking.asp
          we can see that:
          If you're using DHCP, you can use the Win32_NetworkAd apterConfigurat ion
          and
          the ReleaseDHCPLeas e method to release the IP address. If you are not
          using
          DHCP, you cannot use WMI to disable a network connection.
          >
          If you have any other questions or concerns, please feel free to let me
          know. It is my pleasure to be of assistance.
          >
          Charles Wang
          Microsoft Online Community Support
          >
          =============== =============== =============== =========
          When responding to posts, please "Reply to Group" via
          your newsreader so that others may learn and benefit
          from this issue.
          =============== =============== =============== =========
          This posting is provided "AS IS" with no warranties, and confers no
          rights.
          =============== =============== =============== =========
          >
          >
          >
          >

          Comment

          • Charles Wang[MSFT]

            #6
            Re: Remove network connection

            Hi,

            Appreciate your update and response. I am glad to hear that the problem has
            been fixed. If you have any other questions or concerns, please do not
            hesitate to contact us. It is always our pleasure to be of assistance.

            Have a nice day!

            Charles Wang
            Microsoft Online Community Support

            =============== =============== =============== =========
            When responding to posts, please "Reply to Group" via
            your newsreader so that others may learn and benefit
            from this issue.
            =============== =============== =============== =========
            This posting is provided "AS IS" with no warranties, and confers no rights.
            =============== =============== =============== =========

            Comment

            Working...