ASP源码.NET源码PHP源码JSP源码JAVA源码DELPHI源码PB源码VC源码VB源码Android源码

TMG server ISA server 批量添加域名集

来源:网络整理     时间:2016-12-17     关键词:

本篇文章主要介绍了" TMG server ISA server 批量添加域名集",主要涉及到方面的内容,对于VBjrs看球网直播吧_低调看直播体育app软件下载_低调看体育直播感兴趣的同学可以参考一下: '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''...

 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Copyright (c) Microsoft Corporation. All rights reserved.

' THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE

' RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE

' USER. USE AND REDISTRIBUTION OF THIS CODE, WITH OR WITHOUT MODIFICATION, IS

' HEREBY PERMITTED.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' This script creates a new domain name set with the name specified by the user

' if it does not exist and imports all the domain names listed in a text file

' to the domain name set. If the specified domain name set already exists, the

' domain names in the text file are added without removing the existing domain

' names. In either case, duplicates are not added.

' This script has minimal error handling.

' Note that the text file must contain a list of domain names with each domain

' name on a separate line.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Option Explicit

'Define the constants needed

Const Error_FileNotFound = &H80070002

Const ForReading = 1

Main(WScript.Arguments)

Sub Main(args)

If(args.Count <> 2) Then

Usage

End If

AddListToDomainNameSet args(0), args(1)

End Sub

Sub AddListToDomainNameSet(fileName, dnSetName)

' Create the root object.

Dim root ' The FPCLib.FPC root object

Set root = CreateObject("FPC.Root")

'Declare the other objects needed.

Dim isaArray ' An FPCArray object

Dim dnSets ' An FPCDomainNameSets collection

Dim dnSet ' An FPCDomainNameSet object

Dim fso ' A FileSystemObject object

Dim fileStream ' A TextStream object

Dim textRead ' A string

' Get references to the array object

' and the domain name sets collection.

Set isaArray = root.GetContainingArray()

Set dnSets = isaArray.RuleElements.DomainNameSets

' Retrieve the specified domain name set.

On Error Resume Next

Set dnSet = dnSets.Item(dnSetName)

If Err.Number = Error_FileNotFound Then

WScript.Echo "The " & dnSetName & "domain name set does not exist. " _

& "Creating it ..."

Set dnSet = dnSets.Add(dnSetName)

End If

On Error GoTo 0

Set fso = CreateObject("Scripting.FileSystemObject")

Set fileStream = fso.OpenTextFile(fileName, ForReading)

On Error Resume Next

Do While fileStream.AtEndOfStream <> True

textRead = fileStream.ReadLine

If textRead <> "" Then

Err.Clear

dnSet.Item textRead

If Err.Number = Error_FileNotFound Then

Err.Clear

WScript.Echo "Adding " & textRead

dnSet.Add textRead

End If

End If

Loop

On Error GoTo 0

' Save the changes.

dnSets.Save

WScript.Echo "Done!"

WScript.Quit

End Sub 

把以上代码存为VBS就可以了。使用方法 cmd下 cscript   *.vbs  文件名  域名集


文件为txt,格式如下


badiu.com

qq.com

...

以上就介绍了 TMG server ISA server 批量添加域名集,包括了方面的内容,希望对VBjrs看球网直播吧_低调看直播体育app软件下载_低调看体育直播有兴趣的朋友有所帮助。

本文网址链接:http://www.codes51.com/article/detail_4154077.html

相关图片

相关文章