Category:VBS

  • Using VBS to realize local adding user script

    Time:2020-9-21

    Dim WshShell set WshShell = CreateObject(“wscript.Shell”) WshShell.Run “cmd /k” for i = 1 to 3 WScript.Sleep 500 WshShell.SendKeys “net user admin” & i & ” [email protected] /add” WshShell.SendKeys “{ENTER}” next WshShell.SendKeys “exit” WshShell.SendKeys “{ENTER}”

  • VBS ad log open script nablekerblog script

    Time:2020-9-20

    Dim wsObj Set wsObj = CreateObject(“Wscript.Shell”) ‘ Add the LogLevel Value to Kerberos Key in Registry. On Error Resume Next  WScript.Echo “Enabling Kerberos Logging…” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\1 Knowledge Consistency Checker”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\2 Security Events”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\3 ExDS Interface Events”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\4 MAPI Interface Events”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\5 Replication Events”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\6 Garbage Collection”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\7 Internal Configuration”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\8 Directory Access”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\9 Internal Processing”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\10 Performance Counters”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\11 Initialization/Termination”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\12 Service Control”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\13 Name Resolution”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\14 Backup”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\15 Field Engineering”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\16 LDAP Interface Events”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\17 Setup”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\18 Global Catalog”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\19 Inter-site Messaging”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\20 Group Caching”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\21 Linked-Value Replication”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\22 DS RPC Client”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\23 DS RPC Server”,3,”REG_DWORD” wsObj.RegWrite “HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\24 DS Schema”,3,”REG_DWORD” Set wsObj = Nothing  WScript.Echo “-=[Complete!]=-”

  • VBS implementation of compressed folder script

    Time:2020-9-19

    strComputer = “.” Set objWMIService = GetObject(“winmgmts:” _     & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”) Set colFolders = objWMIService.ExecQuery _     (“Select * from Win32_Directory where “) For Each objFolder in colFolders     errResults = objFolder.Compress     Wscript.Echo errResults Next

  • Code of modifying 3389 port of remote desktop and adding it to Windows Firewall with vbs

    Time:2020-9-18

    Save the following code as. VBS, double-click to run. Then restart the system and change the default port 3389 of the remote desktop of the system ‘##################### ‘VBS modifies the default port of the remote desktop and adds it to the windows firewall‘author 51 windows.Net‘56868 is the port to set‘##################### Set WshShell = WScript.CreateObject(“WScript.Shell”) WshShell.RegWrite “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber”,56868,”REG_DWORD” WshShell.RegWrite “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp\PortNumber”,56868,”REG_DWORD” Function Addfirewall(name,port,state)  Set objFirewall = CreateObject(“HNetCfg.FwMgr”) […]

  • VBS is used to automatically check whether the agent is available and set the IE proxy script automatically

    Time:2020-9-17

    Change the address in the following code and save it as ieproxy.vbs Then right-click on the file and select open at command promptDon’t say much. Save it! Copy codeThe code is as follows: strMachines = “24.11.246.125:2406;61.252.60.30:68660;64.161.10.2:3128;65.23.157.55:80;66.229.103.146:5089;68.6.240.207:2521;68.103.105.108:2384;70.160.84.18:2332;71.74.23.52:2220;71.207.239.136:2653;72.187.78.76:2413;76.177.94.222:2569;122.103.185.182:8080;122.197.130.107:2556;128.8.126.111:3128;128.8.126.112:3128;128.112.139.71:3124;128.112.139.71:3128;128.112.139.71:68660;128.119.247.210:8888;128.119.247.211:3128;128.208.4.197:8888;128.208.4.198:3124;128.227.56.82:3128;128.252.19.20:68660;129.24.17.70:3128;129.186.205.77:3128;129.237.161.193:8888;129.237.161.194:8888;138.23.204.133:3124;140.247.60.123:8888;140.247.60.126:8888;160.36.57.173:8888;165.228.129.10:3128;165.228.132.10:3128;169.229.50.3:3128;169.229.50.5:3128;169.229.50.12:3124;169.229.50.12:3128;169.229.50.12:68664;199.89.182.6:80;203.178.133.2:3128;203.178.133.3:3124;203.178.133.3:3128;203.178.133.11:68660;203.198.162.124:8080;206.207.248.34:3124;206.207.248.34:3128;209.197.110.17:80;210.20.67.152:8080;210.125.84.16:3128;216.104.190.179:80;218.5.79.200:80;218.58.136.14:808;221.152.139.220:8080;59.186.67.28:8080;125.142.138.208:2613;210.76.97.79:80;218.152.54.154:8080;12.218.111.15:2356;24.222.80.248:2574;58.71.35.206:8080;60.190.99.218:19759;61.86.48.162:8080;61.252.60.30:3124;61.252.60.30:3128;62.231.243.136:66;62.231.243.137:66;67.164.134.61:2426;67.165.179.84:2495;74.122.236.78:2510;74.129.4.44:2251;76.98.35.94:2303;76.210.118.129:2533;81.211.88.94:3128;82.77.21.83:2263;85.82.145.250:8080;85.214.37.22:3128;122.47.159.72:2400;128.8.126.111:68660;128.10.19.53:8888;128.31.1.11:8888;128.31.1.13:8888;128.31.1.14:3128;128.114.63.14:3124;128.119.247.211:3124;128.238.88.64:3124;128.238.88.65:3128;129.12.3.75:3124;129.82.12.188:8888;129.186.205.77:3124;129.240.67.15:3124;129.240.67.15:3128;129.242.19.197:3124;130.37.198.244:3128;130.37.198.244:68664;132.252.152.193:3124;132.252.152.194:3124;132.252.152.194:3128” aMachines = split(strMachines, “;”) For Each machine2 in aMachines     machinearr = split(machine2, “:”)     machine = machinearr(0)     Set objPing = GetObject(“winmgmts:{impersonationLevel=impersonate}”)._         ExecQuery(“select * from Win32_PingStatus where address = ‘”_             & machine & “‘”)     For Each objStatus in objPing         If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then              WScript.Echo(machine2 & ” is not reachable”)          else              WScript.Echo(machine2 & ” is OK”)  If “confirm” sets the proxy to “& Machine2 -“? […]

  • Script and program of timing shutdown and restart based on vbs

    Time:2020-9-16

    Save the following code as a VBS file, such as: shutdown.vbs , and then double-click or right-click on the fileKey selection to open the command prompt, if you set the restart time, the system will appear shutdown dialogBox. Direct the following code program will appear shutdown dialog box, the last carriage return comment off, normal […]

  • VBS implementation of the script to remind you to rest regularly

    Time:2020-9-15

    Copy codeThe code is as follows: set WshShell = WScript.CreateObject(“WScript.Shell”) ‘dialog titleAlerttitle: “regular reminder”‘remind content, vbnewline is the newline characterAlerttext = vbnewline & vbnewline & “take a break and move your arms, neck and waist. “& vbnewline & vbnewline & vbnewline & vbnewline & vbnewline & vbnewlineFor I = 1 to 12’12 is the number of reminders     WScript.Sleep […]

  • VBS automatic form analysis with source code

    Time:2020-9-14

    dim ie  set ie=createobject(“internetexplorer.application”)  ie.visible=true  ie.navigate “http://www.ln.chinaunicom.com/index.shtml”  While ie.busy or ie.readystate<>4  EndWhile  ie.document.all (“userid”). Value = “13304948957”‘mobile phone numberie.document.all (“passwd”). Value = “111111” ‘passwordie.document.all (“verifycode”). Value = “1111” ‘IDie.document.all.loginOnForm.submit  As soon as the debugging script shows the missing object:“ ie.document.all (“….”)” ” ie.document.all . loginOnForm.submit “This line also shows that the object does not support this property or methodPlease help me to […]

  • Function of converting Chinese characters to Pinyin by vbs

    Time:2020-9-13

    Core code: On Error Resume Next Set d = createObject(“Scripting.Dictionary”) d.add “a”,-20319 d.add “ai”,-20317 d.add “an”,-20304 d.add “ang”,-20295 d.add “ao”,-20292 d.add “ba”,-20283 d.add “bai”,-20265 d.add “ban”,-20257 d.add “bang”,-20242 d.add “bao”,-20230 d.add “bei”,-20051 d.add “ben”,-20036 d.add “beng”,-20032 d.add “bi”,-20026 d.add “bian”,-20002 d.add “biao”,-19990 d.add “bie”,-19986 d.add “bin”,-19982 d.add “bing”,-19976 d.add “bo”,-19805 d.add “bu”,-19784 d.add “ca”,-19775 d.add […]

  • On WMI_ VBS scripting tutorial Supplement 1 / 2

    Time:2020-9-12

    Today, I would like to introduce a friend to you. It is Microsoft Windows Management Instrumentation (WMI). The Chinese name is windows management specification. Since Windows 2000, WMI (Windows Management specification) has been built into the operating system, and has become an important part of windows system management. So it’s easy to see it, because […]

  • Using VBS to realize the code of judging whether a computer is a notebook or a desktop computer

    Time:2020-9-11

    The ChassisTypes property can tell you whether you are using a laptop, desktop, or other type of computer. Oh, input. The following scripts let you know what type of computer you are using: Copy codeThe code is as follows: strComputer = “.”  Set objWMIService = GetObject(“winmgmts:” _  & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)  Set colChassis = objWMIService.ExecQuery _  (“Select * from Win32_SystemEnclosure”)  For Each objChassis in colChassis  For   Each strChassisType in objChassis.ChassisTypes  Wscript.Echo strChassisType  Next  Next  Well, the above scripts only let […]

  • Using VBS to clear the record of logging in IP in IIS log

    Time:2020-9-10

    Option Explicit  Dim sourcefile,ipaddress,objargs const destfile=”tempfile” Const ForWriting = 2 Dim Text Dim fso,objNet,ServiceObj Dim txtStream, txtStreamOut  Set objArgs = WScript.Arguments  If objArgs.Count = 2 Then  sourcefile=objArgs(0) ipaddress=objargs(1) Else wscript.echo “Parameter Error”+ vbcrlf wscript.Echo “USAGE:KillLog.vbs LogFileName YourIP.” wscript.Quit 1 End If Set fso = CreateObject(“Scripting.FileSystemObject”) if fso.FileExists (sourcefile) then Set objNet = WScript.CreateObject( “WScript.Network” ) Set ServiceObj = GetObject(“WinNT://” & objNet.ComputerName & “/w3svc”) Set objNet=nothing ServiceObj.stop wscript.sleep 6000 Set txtStream = fso.OpenTextFile(sourcefile)  Set txtStreamOut = fso.OpenTextFile(destfile, ForWriting, True) Do While Not (txtStream.atEndOfStream)  Text = txtStream.ReadLine  if instr(Text,ipaddress)=0 then txtStreamOut.WriteLine Text  end if Loop Set txtStream = Nothing  Set txtStreamOut = Nothing WScript.Echo “The log file– ” & sourcefile &” has cleaned your IP!” Else WScript.Echo “The Log file– ” & sourcefile & ” has not found!” Wscript.quit End If fso.Copyfile destfile, sourcefile fso.deletefile destfile Set fso=Nothing ServiceObj.start Set ServiceObj = Nothing