以下脚本都在域控上发布使用过,都正常。  每个脚本保存*.VBS即可。
---------------------------------------------------------------------------------------------------------------------------------
vbs脚本怎么停止
加域脚本
On Error Resume Next
dim domain
set domain = createobject("wscript.shell")
Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Const ACCT_DELETE = 4
Const WIN9X_UPGRADE = 16
Const DOMAIN_JOIN_IF_JOINED = 32
Const JOIN_UNSECURE = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144
strDomain = "nd"
strPassword = "密码"
strUser = "域管理权限的帐户"
Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName
Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _
strComputer & "'")
ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, strDomain & "\" & strUser, NULL, _
JOIN_DOMAIN + ACCT_CREATE)
ho "计算机加入域成功"
---------------------------------------------------------------------------------------------------------------------------------
添加打印机
DIM objShell
set ateObject("wscript.shell")
iReturn=objShell.Run(" /C net use \\172.20.10.14\ipc$ ""prt88"" /user:""print""", 0,true)
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\172.20.10.14\4200"
WshNetwork.SetDefaultPrinter "\\172.20.10.14\4200"
DIM cg
cg="打印机添加成功"
msgbox(cg)
---------------------------------------------------------------------------------------------------------------------------------
修改DNS
Const STR_NEWDNS1 = "58.22.96.66"
Const STR_NEWDNS2 = "218.104.128.106"
Set fs=CreateObject("Scripting.FileSystemObject")
strWinMgmt="winmgmts:{impersonationLevel=impersonate}"
Set objNICs = GetObject( strWinMgmt ).InstancesOf("Win32_NetworkAdapterConfiguration")
For Each objNIC In objNICs
If objNIC.IPEnabled Then
objNIC.SetDNSServerSearchOrder Array(STR_NEWDNS1,STR_NEWDNS2)
---------------------------------------------------------------------------------------------------------------------------------
统计电脑配置信息
On Error Resume Next
temp=0
set ateobject("wscript.shell")
Set WshNetwork = WScript.Createobject("WScript.Network")
computername=WshNetwork.ComputerName
strComputer = "."
  Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
  Set cpu = objWMIService.ExecQuery("SELECT * FROM Win32_Processor")
  For Each objItem In cpu
        cpu2="CPU(G): " & objItem.name
        Version2= "Version: " & objItem.Version
Next
set disk =Query("select * from win32_diskdrive")
for each item in disk
    disk2= "HD: " &  del
    size2="Size(GB):"& round(item.size/1000000000)
next
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory")
For Each objItem in colItems
a=objitem.capacity/1048576
temp=temp+objitem.capacity
n=n+1
Next
memory=temp/1048576
if n=1 then
memory2= "Memory: " & n & "*" &a&"M"
else
memory2= "Memory: " & n & "*" &a&"M"&" Total:"&memory&"M"
end if
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_VideoController")
  For Each objItem In colItems
      name= "Video: " & objItem.Name
      RAM ="Video_memory(MB): " & objItem.AdapterRAM/1048576
  Next
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
  For Each objItem In colItems
                operatingsys ="OperatingSystem: " & objItem.Caption
                SP ="SP: " & objItem.CSDVersion
Next
Set board =Query("select * from win32_baseboard")
  for each item in board
  board2= "Mainboard: " & item.Product
Next
SET fso = createobject("scripting.filesystemobject")
txtpath = "\\共享\"&computername&".txt"
set fs = atetextfile(txtpath,true)
fs.writeline("Computername:"+computername)
fs.writeline(cpu2)
fs.writeline(memory2)
fs.write(disk2+"    ")
fs.writeline(size2)
fs.writeline(board2)
fs.write(name)
fs.writeline(ram)
fs.writeline(operatingsys)
fs.writeline(sp)
fs.close
修改本地管理员密码
strComputer="."
strComputer = "."
Set objUser = GetObject("WinNT://" & strComputer & "/Administrator, user")
objUser.SetPassword "密码"
objUser.SetInfo
Set objDomain = GetObject("WinNT://" & strComputer)
objDomain.Filter = Array("User")
For Each objUser in objDomain

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。