国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > VBScript > 正文

利用VBS腳本自動創建計算機帳戶的代碼

2019-10-26 17:58:14
字體:
來源:轉載
供稿:網友
mcse注:其實這是 按照ADSI(Active Directory Services Interface:活動目錄服務接口)寫的程序。如果你安裝了resource kit,這段代碼可以用netcom這條命令進行工作,下面是netcom的一個例子: 

  NETDOM /Domain:MYDOMAIN /user:adminuser /password:apassword MEMBER MYCOMPUTER /ADD 

復制代碼 代碼如下:

  ***********************

  '* Start Script

  '***********************

  Dim sComputerName, sUserOrGroup, sPath, computerContainer, rootDSE, lFlag

  Dim secDescriptor, dACL, ACE, oComputer, sPwd

  '

  '* Declare constants used in defining the default location for the

  '* machine account, flags to identify the object as a machine account,

  '* and security flags

  'Const UF_WORKSTATION_TRUST_ACCOUNT = &H1000

  Const UF_ACCOUNTDISABLE = &H2

  Const UF_PASSWD_NOTREQD = &H20

  Const ADS_GUID_COMPUTRS_CONTAINER = "aa312825768811d1aded00c04fd8d5cd"

  Const ADS_ACETYPE_ACCESS_ALLOWED = 0

  Const ADS_ACEFLAG_INHERIT_ACE = 2

  '

  '* Set the flags on this object to identify it as a machine account

  '* and determine the name. The name is used statically here, but may

  '* be determined by a command line parameter or by using an InputBox

  'lFlag = UF_WORKSTATION_TRUST_ACCOUNT Or UF_ACCOUNTDISABLE Or UF_PASSWD_NOTREQD

  sComputerName = "TestAccount"

  '

  '* Establish a path to the container in the Active Directory where

  '* the machine account will be created. In this example, this will

  '* automatically locate a domain controller for the domain, read the

  '* domain name, and bind to the default "Computers" container

  '*********************************************************************

  Set rootDSE = GetObject("LDAP://RootDSE")

  sPath = "LDAP://  Set computerContainer = GetObject(sPath)

  sPath = "LDAP://" & computerContainer.Get("distinguishedName")

  Set computerContainer = GetObject(sPath)
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 湖南省| 溧阳市| 五常市| 宜都市| 天祝| 宕昌县| 阳谷县| 天峨县| 大庆市| 疏勒县| 丹阳市| 玉屏| 双城市| 大石桥市| 兴文县| 安乡县| 新乡县| 连平县| 浠水县| 丽水市| 宜君县| 广元市| 宜阳县| 辛集市| 华阴市| 阳城县| 湖南省| 阿拉善左旗| 读书| 信阳市| 宝鸡市| 崇左市| 永城市| 界首市| 金华市| 冀州市| 临泽县| 忻州市| 阜平县| 静安区| 保山市|