天天看点

启用网络适配器上的 IPSec

描述

启用网络适配器的 IP 安全性。在此脚本中,所有的l TCP 和 UDP 端口以及所有的l IP 协议都是允许的;因此在每种情况下都传送值

0。如果只允许特定的端口或协议,则应该以数组的形式发送这些值。

支持平台

Windows Server 2003

Windows XP

Windows 2000

Windows NT 4.0

Yes, with WMI

installed

脚本代码

On Error Resume Next

Const ALLOW_ALL =

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" &

strComputer & "\root\cimv2")

Set colNetCards = objWMIService.ExecQuery

_

   ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled =

True")

For Each objNetCard in colNetCards

   arrPermittedTCPPorts =

Array(ALLOW_ALL)

   arrPermittedUDPPorts = Array(ALLOW_ALL)

 arrPermittedIPProtocols = Array(ALLOW_ALL)

   objNetCard.EnableIPSec

arrPermittedTCPPorts, arrPermittedUDPPorts,

arrPermittedIPProtocols

Next

EnableIPSec Method of the Win32_NetworkAdapterConfiguration

Class:

uint32 EnableIPSec( 

继续阅读