Heyho liebes Forum,
ich habe ein paar einfache und vielleicht für einen Anfänger nicht so einfach lösbare Fragen. Ich hab schon Bücher gewälzt, also bitte nicht annehmen, dass kein Versuch unternommen worden wäre um dieses Problem zu lösen. Ich habe ein einfaches und für mich auch simples Skript gefunden, welches ich soweit auch umändern konnte, für meine bisherigen Zwecke. Bis auf eine Sache, die sogenannte Edgeausnahme. Die Edgeausnahme lässt sich damit nicht einstellen. Bei Windows gibt es ja vier Einstellungsmöglichkeiten, wofür es ja auch anscheinend Befehle in anderen Sprachen zu geben scheint. Doch wie übertrage ich diese in Autoit?
Original Skript: (funktioniert soweit)
[autoit]#RequireAdmin
;Add/Enable/Disable Firewall Exception
Func _FirewallException($_intEnableDisable, $_appName, $_applicationFullPath)
$Firewall = ObjCreate("HNetCfg.FwMgr")
$Policy = $Firewall.LocalPolicy
$Profile = $Policy.GetProfileByType(2)
$colApplications = $Profile.AuthorizedApplications
$newApplication = ObjCreate("HNetCfg.FwAuthorizedApplication")
$newApplication.Name = $_appName
$newApplication.IpVersion = 4
$newApplication.ProcessImageFileName = $_applicationFullPath
$newApplication.RemoteAddresses = "*"
$newApplication.Scope = 0
$newApplication.Enabled = $_intEnableDisable
$colApplications.Add($newApplication)
EndFunc ;==>_FirewallException
;Example usage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Example block Autoit
;_FirewallException(0, "Autoit", @AutoItExe)
;Example allow Autoit
_FirewallException(1, "Autoit", @AutoItExe)
Skript von mir geändert: (funktioniert, bis auf Zeile 13, welche nicht funktioniert.)
[autoit]#RequireAdmin
Func _FirewallException($_intEnableDisable, $_appName, $_applicationFullPath)
$Firewall = ObjCreate("HNetCfg.FwMgr")
$Policy = $Firewall.LocalPolicy
$Profile = $Policy.GetProfileByType(2)
$colApplications = $Profile.AuthorizedApplications
$newApplication = ObjCreate("HNetCfg.FwAuthorizedApplication")
$newApplication.Name = $_appName
$newApplication.IpVersion = 2
$newApplication.ProcessImageFileName = $_applicationFullPath
$newApplication.RemoteAddresses = "*"
$newApplication.Scope = 0
$newApplication.EdgeTraversal = TRUE ;Anstatt TRUE habe ich auch 1 und 0 versucht.
$newApplication.Enabled = $_intEnableDisable
$colApplications.Add($newApplication)
EndFunc
;Example allow Autoit
_FirewallException(1, "Autoit", @AutoItExe)
Mir fällt grade auf, dass fehlt was ich eigentlich machen möchte. Nun ich möchte eine Edgeausnahme im besten Fall auf "Auf Anwendung zurückstellen" haben. Das wäre perfekt.
Ich bitte um Hilfe.
Mit freundlichen Grüßen
Euer Sol.LrMartyn