Wippika Posted October 12, 2004 Share Posted October 12, 2004 God morgon Gjorde mig ett script som skulle sätta upp några undantags regler i brandväggen, men inte fungerar det!! använder följande kod som inte genererar några fel men när scriptet så läggs bara en av dom fyra undantagen till, kan variera vilken som läggs till!! Option Explicit ' Set constants Const NET_FW_PROFILE_DOMAIN = 0 Const NET_FW_PROFILE_STANDARD = 1 ' Scope Const NET_FW_SCOPE_ALL = 0 ' IP Version – ANY is the only allowable setting for now Const NET_FW_IP_VERSION_ANY = 2 ' Declare variables Dim errornum ' Create the firewall manager object. Dim fwMgr Set fwMgr = CreateObject("HNetCfg.FwMgr") ' Get the current profile for the local firewall policy. Dim profile Set profile = fwMgr.LocalPolicy.CurrentProfile Dim app Set app = CreateObject("HNetCfg.FwAuthorizedApplication") ' Client trust, BORDERMANAGER app.ProcessImageFileName = "Z:\clntrust.exe" app.Name = "CLN Trust" app.Scope = NET_FW_SCOPE_ALL ' Use either Scope or RemoteAddresses, but not both 'app.RemoteAddresses = "*" app.IpVersion = NET_FW_IP_VERSION_ANY app.Enabled = TRUE 'Internet Explorer app.ProcessImageFileName = "C:\Program\Internet Explorer\iexplore.exe" app.Name = "Internet Explorer" app.Scope = NET_FW_SCOPE_ALL ' Use either Scope or RemoteAddresses, but not both 'app.RemoteAddresses = "*" app.IpVersion = NET_FW_IP_VERSION_ANY app.Enabled = TRUE 'Novell Login app.ProcessImageFileName = "C:\WINDOWS\system32\loginw32.exe" app.Name = "Novell login" app.Scope = NET_FW_SCOPE_ALL ' Use either Scope or RemoteAddresses, but not both 'app.RemoteAddresses = "*" app.IpVersion = NET_FW_IP_VERSION_ANY app.Enabled = TRUE 'dpmw32, Novell NDPS service app.ProcessImageFileName = "C:\WINDOWS\system32\dpmw32.exe" app.Name = "NDPS Service" app.Scope = NET_FW_SCOPE_ALL ' Use either Scope or RemoteAddresses, but not both 'app.RemoteAddresses = "*" app.IpVersion = NET_FW_IP_VERSION_ANY app.Enabled = TRUE ' Use this line if you want to add the app, but disabled. 'app.Enabled = FALSE On Error Resume Next errornum = 0 profile.AuthorizedApplications.Add app errornum = Err.Number if errornum <> 0 then Wscript.Echo("Adding authorized application failed with: " & errornum) Link to comment Share on other sites More sharing options...
Jesper Holmberg Posted October 12, 2004 Share Posted October 12, 2004 Vild gissning: race condition..? Vet inte om det är nån hjälp, men när jag skrev en batchfil för att göra ungefär samma som du, använde jag netsh firewall istället. Link to comment Share on other sites More sharing options...
Anjuna Moon Posted October 12, 2004 Share Posted October 12, 2004 Frågan är redan löst i annan tråd (//eforum.idg.se/viewmsg.asp?entriesid=631417#631424) [inlägget ändrat 2004-10-12 16:03:58 av Anjuna Moon] Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.