none
Automatically configure network card (The Internet vs Work networks)

    Question

  • In the "Configure Network Adapters" screen in Win Mobile 5 and Pocket PC 2003 you can manually set "My network card connects to:" The Internet or Work.  I'm looking for a way to do this automatically.  I need the device's NIC to connect to the "Work" network or my Connection Manager mapping CPF won't work.  I'd like to set this setting in .Net code or in a CPF file, but I'd be interested to hear any way this could be done.  Can anyone help me?

     

    Thanks.

    Tuesday, July 31, 2007 2:56 PM

Answers

All replies

  • Hi LowaEric,

               Programmatically you do it by feeding the xml to DMProcessConfigXML(). The problem is that you will most likely get the same security-related failure unless you sign your executable. The advantage is that you sign the executable only once, so if you do a lot of provisioning, you don't have to sign every .cpf .

              You can also search in the forum, click the link below:

    http://forums.microsoft.com/MSDN/Search/Search.aspx?words=CPF&searchKey=&lcid=1033&searchscope=forumgroupscope&siteid=1&ForumID=-1&ForumGroupID=11&GoButton=+Go

     

     

     

     

     

    Best regards,

    Guang-Ming Bian-MSFT

     

    Thursday, August 02, 2007 5:45 AM
    Moderator
  • Thanks for your reply.  What I'm looking for is the XML that will change this setting.  I can handle the signing/security issues, but I can't find the XML that I need.  If you could tell me the XML, that would be great.

     

    Thanks,

    IowaEric

     

    Thursday, August 02, 2007 9:44 PM
  • Hi lowaEric,

    There is a xml sample in this issue and you can also search in the forum, click the link below:

    http://forums.microsoft.com/MSDN/Search/Search.aspx?words=DMProcessConfigXML&localechoice=9&SiteID=1&searchscope=forumgroupscope&ForumGroupID=11

     

     

     

    Best regards,

    Guang-Ming Bian - MSFT

    Friday, August 03, 2007 6:23 AM
    Moderator
  • Thank you for your reply.

     

    We seem to have a miscommunication.  I am familiar with the layout of the XML that goes into a CPF.  What I'd like to learn are the characteristics, parameters and values to change the configuration of the network card. If I have

     

    <wap-provisioningdoc>

        <characteristic type="?">

            <parm name="?" value="?"/>

        </characteristic>

    </wap-provisioningdoc>

     

    in an XML file that I will put in a signed CPF, what would I replace the ?s with to configure my network card to use the Work Network instead of The Internet?

     

    Thank you for your patience,

    IowaEric

    Friday, August 03, 2007 9:00 PM
  • Check out if this sample may be of use:

    http://msdn2.microsoft.com/en-us/library/aa456062.aspx

     

    the sample shows how to bind a NIC to the Work destination

     

    I beleive you should replace the value for the destId parameter with the following guid:

    {436EF144-B4FB-4863-A041-8F905A62C572}  ,

    in order to have the Internet destination binded.

     

    here comes an example containing the predifined destId values for the default destinations:

    http://msdn2.microsoft.com/en-us/library/aa456107.aspx

     

    Few more examplesSadCM_NetEntries Configuration Provider)

    http://msdn2.microsoft.com/en-us/library/aa456087.aspx

     

     

     

     

     

    Friday, August 03, 2007 11:01 PM
  • Thank you very much. Unfortunately, now I'm having trouble finding the "fully qualified name" of my network adapter.  I can't find how to do GetAdaptersAddresses() in C# for Win Mobile 5. Your blog only had the link to the MSDN definition. If you could tell me how to do that, too, it would be great.

     

    Monday, August 06, 2007 4:05 PM
  • as an option you may use vxUtils to get the names of the available adapters.

    menu Function/Info and you'll get the adapter names - the first part (before the dash) is the one you need

     

    if you need a programatic access you may try the classes from the OpenNETCF.Net namespace or try playing with this example

     

     

     

    Tuesday, August 07, 2007 9:12 PM
  • Sorry it took me so long to reply.  I ended up getting around this by using two CPFs - one for "My Work Network" and another for "My ISP".  If I can't connect the first time, I assume that the network card is configured for the other network and I run the other CPF.  Thanks for all your help, I really appreciate it.

    Thursday, August 23, 2007 4:13 PM
  • Hi,

     

    You can use SystemSate class for find the name of the NIC.

     

    Debug.WriteLine(" ConnectionsNetworkAdapters : " + Microsoft.WindowsMobile.Status.SystemState.ConnectionsNetworkAdapters.ToString)

    Debug.WriteLine(" ConnectionsNetworkDescriptions : " + Microsoft.WindowsMobile.Status.SystemState.ConnectionsNetworkDescriptions.ToString)

     

    Details in Windows Mobile 5 SDK.

     

    Friday, August 24, 2007 8:08 AM
  • Hi,  Four years on and I am trying to do the same thing, change from Work to Internet as the default. A number of the links that were provided to help you resolve this have died and I am struggling to follow what is needed.  Please could you post the CPF XML as I am trying to execute the XML through the Configuration Manager and I have tried a lot of different options...

     

    const string networkInternetDefault="<wap-provisioningdoc>"+ " <characteristic type=\"CM_Networks\">"+ "<characteristic type=\"The Internet\">" +" <parm name=\"DestId\" "+ " value=\"{436EF144-B4FB-4863-A041-8F905A62C572}\" />"+ " </characteristic>"+ " </characteristic>"+ " <characteristic type=\"CM_NetEntries\">"+ " <characteristic type=\"The Internet\">"+ " <parm name=\"DestId\" "+ " value=\"{436EF144-B4FB-4863-A041-8F905A62C572}\" />"+ " <parm name=\"Adapter\" "+ " value=\"Symbol PHOTON Wireless LAN Driver\" />"+ " </characteristic>"+ " </characteristic>"+ " <characteristic type=\"CM_Planner\" >"+" <characteristic type=\"PreferredConnections\" >" +" <parm name=\"{436EF144-B4FB-4863-A041-8F905A62C572}\" " +" value=\"The Internet\" />"+" </characteristic>"+ " </characteristic>"+"</wap-provisioningdoc>"

    ;

    XmlDocument

    configDoc = new XmlDocument();

    configDoc.LoadXml(networkInternetDefault);

     

    ConfigurationManager.ProcessConfiguration(configDoc, false);

     

     

     

    Wednesday, April 06, 2011 10:54 AM