- 浏览: 809190 次
- 性别:
- 来自: 西安
文章分类
- 全部博客 (307)
- struts (8)
- hibernate (3)
- spring (32)
- opensourceproject (12)
- javaScript (9)
- primeton EOS (2)
- journey of heart (10)
- Design pattern (6)
- ejb (17)
- point (37)
- Linux&Unix (22)
- ibatis (10)
- AJAX (6)
- DB (26)
- Protocol (6)
- chart (4)
- web server (11)
- webservice (7)
- integration (3)
- tuxedo (5)
- ext (4)
- android (1)
- c/c++ (12)
- JVM (1)
- paginationFrame (2)
- code (2)
- report (1)
- High-performance web (1)
- svn (1)
- JQuery (1)
- workDaily (2)
- cloud (16)
- Python (8)
- English (2)
- shell (5)
- googleCode (1)
- nio (1)
- hyper-v (1)
- debug (3)
- vbs (2)
- openstack (3)
- K8S (1)
- Mesos (0)
- Spark (0)
- Marathon (0)
最新评论
-
钱图大展:
chao2751021 写道lib包哪里去下载,找不到
大型网站用户行为记录的一个实现--基于clickStream(第一部分) -
钱图大展:
无法下载
大型网站用户行为记录的一个实现--基于clickStream(第一部分) -
fm395728572:
shell脚本中用到了环境变量,但是获取不到,例如脚本中有一句 ...
ganymed-ssh2 for Java -
liuhanjiang:
我qq147229234
大型网站用户行为记录的一个实现--基于clickStream(第一部分) -
liuhanjiang:
博主 我利用您提供的方法实现博文中介绍的clickstream ...
大型网站用户行为记录的一个实现--基于clickStream(第一部分)
vbs 脚本是在windos OS上 run 的一种脚本语言,类似于linux上的shell
我们的product 使用vbs脚本来给virtual machine 设置hostname ,ip,netmask ,ect..
下面主要谈下 vbs操作防火墙:
You can use any of the VBScript programs below in ActiveXperts Network Monitor . Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.
Add an Authorized Application
Adds Freecell.exe to the list of authorized applications in the current Windows Firewall profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set objApplication = CreateObject("HNetCfg.FwAuthorizedApplication") objApplication.Name = "Free Cell" objApplication.IPVersion = 2 objApplication.ProcessImageFileName = "c:\windows\system32\freecell.exe" objApplication.RemoteAddresses = "*" objApplication.Scope = 0 objApplication.Enabled = True Set colApplications = objPolicy.AuthorizedApplications colApplications.Add(objApplication)
Add an Application to the Standard Profile
Adds Freecell.exe to the list of authorized applications in the Windows Firewall standard profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy Set objProfile = objPolicy.GetProfileByType(1) Set objApplication = CreateObject("HNetCfg.FwAuthorizedApplication") objApplication.Name = "Free Cell" objApplication.IPVersion = 2 objApplication.ProcessImageFileName = "c:\windows\system32\freecell.exe" objApplication.RemoteAddresses = "*" objApplication.Scope = 0 objApplication.Enabled = True Set colApplications = objProfile.AuthorizedApplications colApplications.Add(objApplication)
Create a New Port
Opens port 9999 in the Windows Firewall current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set objPort = CreateObject("HNetCfg.FwOpenPort") objPort.Port = 9999 objPort.Name = "Test Port" objPort.Enabled = FALSE Set colPorts = objPolicy.GloballyOpenPorts errReturn = colPorts.Add(objPort)
Delete an Authorized Application
Deletes Freecell.exe from the list of authorized applications in the Windows Firewall current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set colApplications = objPolicy.AuthorizedApplications errReturn = colApplications.Remove("c:\windows\system32\freecell.exe")
Disable the Firewall
Disables the Windows Firewall for the current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile objPolicy.FirewallEnabled = FALSE
Delete an Open Port
Closes port 9999 in the Windows Firewall current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set colPorts = objPolicy.GloballyOpenPorts errReturn = colPorts.Remove(9999,6)
Disable Remote Administration
Disable Windows Firewall remote administration.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set objAdminSettings = objPolicy.RemoteAdminSettings objAdminSettings.Enabled = FALSE
Enable the Firewall
Enables Windows Firewall for the current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile objPolicy.FirewallEnabled = TRUE
Enable File and Printer Sharing Through Windows Firewall
Enables File and Printer Sharing on a computer running Windows XP Service Pack 2.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set colServices = objPolicy.Services Set objService = colServices.Item(0) objService.Enabled = TRUE
Enable Remote Administration
Enables remote administration of Windows Firewall fro the current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set objAdminSettings = objPolicy.RemoteAdminSettings objAdminSettings.Enabled = TRUE
List Authorized Applications
Lists all authorized applications for the Windows Firewall current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set colApplications = objPolicy.AuthorizedApplications For Each objApplication in colApplications Wscript.Echo "Authorized application: " & objApplication.Name Wscript.Echo "Application enabled: " & objApplication.Enabled Wscript.Echo "Application IP version: " & objApplication.IPVersion Wscript.Echo "Application process image file name: " & _ objApplication.ProcessImageFileName Wscript.Echo "Application remote addresses: " & _ objApplication.RemoteAddresses Wscript.Echo "Application scope: " & objApplication.Scope Wscript.Echo Next
List Authorized Applications in the Standard Profile
Lists all authorized applications for the Windows Firewall standard profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy Set objProfile = objPolicy.GetProfileByType(1) Set colApplications = objProfile.AuthorizedApplications For Each objApplication in colApplications Wscript.Echo "Authorized application: " & objApplication.Name Wscript.Echo "Application enabled: " & objApplication.Enabled Wscript.Echo "Application IP version: " & objApplication.IPVersion Wscript.Echo "Application process image file name: " & _ objApplication.ProcessImageFileName Wscript.Echo "Application remote addresses: " & _ objApplication.RemoteAddresses Wscript.Echo "Application scope: " & objApplication.Scope Wscript.Echo Next
List All Globally-Open Ports
Lists all globally-open ports for the Windows Firewall current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set colPorts = objPolicy.GloballyOpenPorts For Each objPort in colPorts Wscript.Echo "Port name: " & objPort.Name Wscript.Echo "Port number: " & objPort.Port Wscript.Echo "Port IP version: " & objPort.IPVersion Wscript.Echo "Port protocol: " & objPort.Protocol Wscript.Echo "Port scope: " & objPort.Scope Wscript.Echo "Port remote addresses: " & objPort.RemoteAddresses Wscript.Echo "Port enabled: " & objPort.Enabled Wscript.Echo "Port built-in: " & objPort.Builtin Next
List Firewall Properties
Lists Windows Firewall properties for the current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Wscript.Echo "Current profile type: " & objFirewall.CurrentProfileType Wscript.Echo "Firewall enabled: " & objPolicy.FirewallEnabled Wscript.Echo "Exceptions not allowed: " & objPolicy.ExceptionsNotAllowed Wscript.Echo "Notifications disabled: " & objPolicy.NotificationsDisabled Wscript.Echo "Unicast responses to multicast broadcast disabled: " & _ objPolicy.UnicastResponsestoMulticastBroadcastDisabled
List Firewall Service Properties
Lists service properties for the Windows Firewall current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set colServices = objPolicy.Services For Each objService in colServices Wscript.Echo "Service name: " & objService.Name Wscript.Echo "Service enabled: " & objService.Enabled Wscript.Echo "Service type: " & objService.Type Wscript.Echo "Service IP version: " & objService.IPVersion Wscript.Echo "Service scope: " & objService.Scope Wscript.Echo "Service remote addresses: " & objService.RemoteAddresses Wscript.Echo "Service customized: " & objService.Customized Set colPorts = objService.GloballyOpenPorts For Each objPort in colPorts Wscript.Echo "Port name: " & objPort.Name Wscript.Echo "Port number: " & objPort.Port Wscript.Echo "Port enabled: " & objPort.Enabled Wscript.Echo "Port built-in: " & objPort.BuiltIn Wscript.Echo "Port IP version: " & objPort.IPVersion Wscript.Echo "Port protocol: " & objPort.Protocol Wscript.Echo "Port remote addresses: " & objPort.RemoteAddresses Wscript.Echo "Port scope: " & objPort.Scope Next Wscript.Echo Next
List ICMP Settings
Lists ICMP settings for the Windows Firewall current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set objICMPSettings = objPolicy.ICMPSettings Wscript.Echo "Allow inbound echo request: " & _ objICMPSettings.AllowInboundEchoRequest Wscript.Echo "Allow inbound mask request: " & _ objICMPSettings.AllowInboundMaskRequest Wscript.Echo "Allow inbound router request: " & _ objICMPSettings.AllowInboundRouterRequest Wscript.Echo "Allow inbound timestamp request: " & _ objICMPSettings.AllowInboundTimestampRequest Wscript.Echo "Allow outbound destination unreachable: " & _ objICMPSettings.AllowOutboundDestinationUnreachable Wscript.Echo "Allow outbound packet too big: " & _ objICMPSettings.AllowOutboundPacketTooBig Wscript.Echo "Allow outbound parameter problem: " & _ objICMPSettings.AllowOutboundParameterProblem Wscript.Echo "Allow outbound source quench: " & _ objICMPSettings.AllowOutboundSourceQuench Wscript.Echo "Allow outbound time exceeded: " & _ objICMPSettings.AllowOutboundTimeExceeded Wscript.Echo "Allow redirect: " & objICMPSettings.AllowRedirect
List Remote Administration Settings
Lists remote administration settings for the Windows Firewall current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set objAdminSettings = objPolicy.RemoteAdminSettings Wscript.Echo "Remote administration settings enabled: " & _ objAdminSettings.Enabled Wscript.Echo "Remote administration addresses: " & _ objAdminSettings.RemoteAddresses Wscript.Echo "Remote administration scope: " & objAdminSettings.Scope Wscript.Echo "Remote administration IP version: " & objAdminSettings.IPVersion
List Standard Profile Properties
Demonstration script that connects to and returns information about the Windows Firewall standard profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy Set objProfile = objPolicy.GetProfileByType(1) Wscript.Echo "Firewall enabled: " & objProfile.FirewallEnabled Wscript.Echo "Exceptions not allowed: " & objProfile.ExceptionsNotAllowed Wscript.Echo "Notifications disabled: " & objProfile.NotificationsDisabled Wscript.Echo "Unicast responses to multicast broadcast disabled: " & - objProfile.UnicastResponsestoMulticastBroadcastDisabled
Modify an ICMP Setting
Demonstration script that modifies a Windows Firewall ICMP setting for the current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set objICMPSettings = objPolicy.ICMPSettings objICMPSettings.AllowRedirect = TRUE
Modify a Firewall Property
Demonstration script that modifies Windows Firewall properties for the current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile objPolicy.ExceptionsNotAllowed = TRUE objPolicy.NotificationsDisabled = TRUE objPolicy.UnicastResponsestoMulticastBroadcastDisabled = TRUE
Open a Closed Port
Opens closed port 9999 for the Windows Firewall current profile.
Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile Set colPorts = objPolicy.GloballyOpenPorts Set objPort = colPorts.Item(9999,6) objPort.Enabled = TRUE
Restore the Default Settings
Restore the Windows Firewall default settings.
Set objFirewall = CreateObject("HNetCfg.FwMgr") objFirewall.RestoreDefaults()
转载:
http://www.activexperts.com/activmonitor/windowsmanagement/scripts/networking/windowsfirewall/
相关推荐
"WinCC 使用 VBS 脚本操作趋势曲线" WinCC 是 Siemens 公司推出的-human-machine-interface(HMI)软件,用于 industrial automation 领域。WinCC 提供了强大的脚本编程功能,允许用户使用 VBS(Visual Basic ...
在VBS中操作Word,主要是通过与Word的对象模型进行交互,利用各种对象、方法和属性来实现对Word文档的各种操作。 首先,核心的两个对象是`Application`对象和`Document`对象。`Application`对象代表Word应用程序...
VBS使用对象模型来操作网页元素,比如InternetExplorer对象用于打开浏览器,Document对象代表网页内容,而Element对象则代表HTML元素。例如,我们可以通过以下方式打开浏览器并导航到登录页面: ```vbscript Set IE...
vbs 操作网页.txt
在本文中,我们将探讨如何在WinCC中通过Visual Basic Script (VBS)来操作SQL Server 2005数据库,实现数据的存储和查询功能。 首先,确保你的WinCC项目已经与SQL Server 2005集成。自WinCC 6.2版本起,系统开始支持...
本文将对使用VBs操作WinCC画面脚本的知识点进行详细总结,涵盖以下内容: 1. 如何操作WinCC画面中的控件属性: - 通过定义VBs的Sub过程来直接修改控件属性,例如通过SubOnClick事件处理函数来修改控件的Radius...
vbs操作excel全集是指使用VBScript语言来控制和操作Excel应用程序的各种方法和技术。本文将对vbs操作excel全集进行详细的说明和介绍。 使用动态创建的方法 使用VBScript可以动态创建Excel对象,从而控制和操作...
### VBS 操作 Excel 排序详解 在 IT 领域中,VBS (Visual ...通过本文的学习,相信您已经掌握了如何使用 VBS 来实现 Excel 数据的排序操作。这对于日常办公自动化具有重要意义。希望本文能对您的学习和工作有所帮助!
本文档提供了详细的操作指南,用于在西门子WinCC环境下使用VBS调用文件打开对话框。 首先,文档描述了测试环境,明确指出系统环境为Windows XP SP3和Internet Explorer 6.0 SP3。在这样的环境下,作者详细阐述了...
在本实例中,我们关注的是如何使用VBS来操作Excel。通过VBS与Excel的交互,我们可以实现数据的读取、写入、编辑等操作,这对于数据处理和分析非常有用。下面将详细介绍VBS操作Excel的相关知识点。 1. **创建Excel...
在VBScript(VBS)中操作Microsoft Excel是一项常见的任务,特别是在自动化办公流程或生成报告时。以下是一些关键知识点和步骤,用于通过VBS与Excel交互: 1. **创建Excel对象**: 使用`CreateObject`函数动态创建...
wincc中使用VBS脚本读写SQLServer数据库文件
在本场景中,我们关注的是如何使用VBS来控制浏览器操作,实现自动化。这通常涉及到与Web浏览器的交互,如打开网页、填写表单、点击按钮等,从而提升工作效率或执行一些自动化的测试任务。 以下是一个简单的VBS脚本...
这使得开发者可以使用熟悉的ADO对象和方法来执行CRUD(创建、读取、更新、删除)操作,而无需深入学习SQLite的特定API。 要使用SQLite ODBC驱动,你需要进行以下步骤: 1. **安装驱动**:这通常涉及下载并运行像`...
本文总结了使用 VBS 编写宏操作 Excel 的常见方法,涵盖了动态创建 Excel 对象、显示当前窗口、更改 Excel 标题栏、添加新工作簿、打开已存在的工作簿、设置活动工作表、给单元格赋值、设置指定列的宽度、设置指定行...
java调用,vbs操作excel