locked
FireWall Dll - HNetCfg.FwMgr object RRS feed

  • Question

  • Hello,

    I was wondering if there is a dll for the firewall functions.
    For example if i want to list authorized apps i do something like this:

    [code] $fwMgr = ObjCreate("HNetCfg.FwMgr")
     $profile = $fwMgr.LocalPolicy.CurrentProfile
     $aApps = $profile.AuthorizedApplications
     Local $aArray[$aApps.Count][6]
     Local $iIndex = 0
     For $app In $aApps
      $aArray[$iIndex][0] = $app.Name
      $aArray[$iIndex][1] = $app.Enabled
      $aArray[$iIndex][2] = $app.IPVersion
      $aArray[$iIndex][3] = $app.ProcessImageFileName
      $aArray[$iIndex][4] = $app.RemoteAddresses
      $aArray[$iIndex][5] = $app.Scope
      $iIndex = $iIndex + 1
     Next
     Return $aArray[/code]

    which will return me an array with the infos.
    I use AutoIT but since it is not in pure AutoIT it would be easy for C users to understand the code above.

    So my question is, is there a dll to use for firewall. My goal is to translate this in pure autoit.

    Cheers and thank you for you time.
    Leandro B.

    Sunday, January 12, 2014 2:43 AM

Answers

  • Hi Leandro,

    Welcome to msdn forum.

    This forum is to discuss problems of C# development. Your question is not related to the topic of this forum.

    According to your description,

    [code] $fwMgr = ObjCreate("HNetCfg.FwMgr")
     $profile = $fwMgr.LocalPolicy.CurrentProfile
     $aApps = $profile.AuthorizedApplications
     Local $aArray[$aApps.Count][6]
     Local $iIndex = 0
     For $app In $aApps
      $aArray[$iIndex][0] = $app.Name
      $aArray[$iIndex][1] = $app.Enabled
      $aArray[$iIndex][2] = $app.IPVersion
      $aArray[$iIndex][3] = $app.ProcessImageFileName
      $aArray[$iIndex][4] = $app.RemoteAddresses
      $aArray[$iIndex][5] = $app.Scope
      $iIndex = $iIndex + 1
     Next
     Return $aArray[/code]

    I think your issue is related to PowerShell.

    So you can consider post your issue to windows PowerShell forum

    Hope this helps you.

    Best Regards,

    Eileen



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Eileen ni Monday, January 20, 2014 1:27 AM
    Monday, January 13, 2014 10:20 AM

All replies

  • Hi Leandro,

    Welcome to msdn forum.

    This forum is to discuss problems of C# development. Your question is not related to the topic of this forum.

    According to your description,

    [code] $fwMgr = ObjCreate("HNetCfg.FwMgr")
     $profile = $fwMgr.LocalPolicy.CurrentProfile
     $aApps = $profile.AuthorizedApplications
     Local $aArray[$aApps.Count][6]
     Local $iIndex = 0
     For $app In $aApps
      $aArray[$iIndex][0] = $app.Name
      $aArray[$iIndex][1] = $app.Enabled
      $aArray[$iIndex][2] = $app.IPVersion
      $aArray[$iIndex][3] = $app.ProcessImageFileName
      $aArray[$iIndex][4] = $app.RemoteAddresses
      $aArray[$iIndex][5] = $app.Scope
      $iIndex = $iIndex + 1
     Next
     Return $aArray[/code]

    I think your issue is related to PowerShell.

    So you can consider post your issue to windows PowerShell forum

    Hope this helps you.

    Best Regards,

    Eileen



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Eileen ni Monday, January 20, 2014 1:27 AM
    Monday, January 13, 2014 10:20 AM
  • Hi Elleen, What I am asking here is not to correct my code or something. I am just asking if there is a dll for the firewall
    Tuesday, January 14, 2014 5:01 AM