[原创]测试服务器是否是GC的脚本
strComputer = "ipcore-sh"<br><br><br>
<br>
Const NTDSDSA_OPT_IS_GC = 1<br>
<br><br>
<br>
Set objRootDSE = GetObject("LDAP://" & strComputer & "/rootDSE")<br>
<br>
strDsServiceDN = objRootDSE.Get("dsServiceName")<br>
<br>
Set objDsRoot = GetObject("LDAP://" & strComputer & "/" & strDsServiceDN)<br>
<br>
intOptions = objDsRoot.Get("options")<br>
<br><br>
<br>
If intOptions And NTDSDSA_OPT_IS_GC Then<br>
<br>WScript.Echo strComputer & " is a global catalog server."<br>
<br>
Else<br>
<br>Wscript.Echo strComputer & " is not a global catalog server."<br>
<br>
End If<br>
<br>
还有很多脚本,如果需要的话,可以留下电子邮件。
re:我以前是程序员出身,现在转行做IT。所以...
我以前是程序员出身,现在转行做IT。所以,对写脚本很有兴趣,和我同样感兴趣的朋友,可以一起交流,学习。re:怎么没人顶啊~~这么好的东东~~
怎么没人顶啊~~<br>这么好的东东~~
re:不错,刚好用得上呢
不错,刚好用得上呢re:不错,加精华。P.S:此帖将转向Wi...
不错,加精华。<br>P.S:此帖将转向Windows区。
re:谢谢钉子版主的大力支持。大家对我的支...
谢谢钉子版主的大力支持。<br>大家对我的支持是最大的动力。<br>
<br>
以后会陆续发一些脚本上来的。 有没有服务器脚本的资料呀 感谢分享呀! Set objRootDSE = GetObject("LDAP://rootDSE")
Dim text
' Schema Master
Set objSchema = GetObject("LDAP://" & objRootDSE.Get("schemaNamingContext"))
strSchemaMaster = objSchema.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strSchemaMaster)
Set objComputer = GetObject(objNtds.Parent)
text="架构主机(Schema Master): " & objComputer.Name & vbCrLf
Set objNtds = Nothing
Set objComputer = Nothing
' Domain Naming Master
Set objPartitions = GetObject("LDAP://CN=Partitions," & _
objRootDSE.Get("configurationNamingContext"))
strDomainNamingMaster = objPartitions.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strDomainNamingMaster)
Set objComputer = GetObject(objNtds.Parent)
text=text&"域命名主机(Domain Naming Master): " & objComputer.Name & vbCrLf
Set objNtds = Nothing
Set objComputer = Nothing
' PDC Emulator
Set objDomain = GetObject("LDAP://" & objRootDSE.Get("defaultNamingContext"))
strPdcEmulator = objDomain.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strPdcEmulator)
Set objComputer = GetObject(objNtds.Parent)
text=text&"PDC 仿真器(PDC Emulator): " & objComputer.Name & vbCrLf
Set objNtds = Nothing
Set objComputer = Nothing
' RID Master
Set objRidManager = GetObject("LDAP://CN=RID Manager$,CN=System," & _
objRootDSE.Get("defaultNamingContext"))
strRidMaster = objRidManager.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strRidMaster)
Set objComputer = GetObject(objNtds.Parent)
text=text&"RID 主机(RID Master): " & objComputer.Name & vbCrLf
Set objNtds = Nothing
Set objComputer = Nothing
' Infrastructure Master
Set objInfrastructure = GetObject("LDAP://CN=Infrastructure," & _
objRootDSE.Get("defaultNamingContext"))
strInfrastructureMaster = objInfrastructure.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strInfrastructureMaster)
Set objComputer = GetObject(objNtds.Parent)
text=text&"結构主机(Infrastructure Master): " & objComputer.Name & vbCrLf
text=text & vbCrLf &" 由 CoolerMaster MIS Dept. (hlr@coolermaster.com.cn) 修改."
WScript.Echo text 学习中
页:
[1]
