2.列舉進程 @echo for each ps in getobject _ >ps.vbs @echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>ps.vbs @echo wscript.echo ps.handle^vbtab^ps.name^vbtab^ps.executablepath:next >>ps.vbs
用法:cscript ps.vbs
3.終止進程 @echo for each ps in getobject _ >pskill.vbs @echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>pskill.vbs @echo if ps.handle=wscript.arguments(0) then wscript.echo ps.terminate:end if:next >>pskill.vbs
用法:cscript pskill.vbs pid
4.重啟系統 @echo for each os in getobject _ >reboot.vbs @echo ("winmgmts:!\\.\root\cimv2:win32_operatingsystem").instances_ >>reboot.vbs @echo os.win32shutdown(2):next >>reboot.vbs
DIM WSH SET WSH=WSCRIPT.CreateObject("WSCRIPT.SHELL") '擊活WScript.Shell對象 WSH.POPUP("解鎖注冊表編輯器!") '顯示彈出信息“解鎖注冊表編輯器!” WSH.Regwrite"HKCU\Software\Microsoft\Windows\CurrentVersion \Policies\System\DisableRegistryTools",0,"REG_DWORD" '給注冊表編輯器解鎖 WSH.POPUP("注冊表解鎖成功!") '顯示彈出信息“注冊表解鎖成功!” 保存為以.vbs為擴展名的文件,使用時雙擊即可。
二、關閉Win NT/2000的默認共享
用記事本編輯如下內容:
Dim WSHShell'定義變量 set WSHShell=CreateObject("WScript.shell") '創建一個能與操作系統溝通的對象WSHShell Dim fso,dc Set fso=CreateObject("Scripting.FileSystemObject")'創建文件系統對象 set dc=fso.Drives '獲取所有驅動器盤符 For Each d in dc Dim str WSHShell.run("net share"d.driveletter "$ /delete")'關閉所有驅動器的隱藏共享 next WSHShell.run("net share admin$ /delete") WSHShell.run("net share ipc$ /delete")'關閉admin$和ipc$管道共享
strComputer= "." Set objWMIService = GetObject("winmgmts:" _ "{impersonationLevel=impersonate,(Backup)}!\\" _ strComputer "\root\cimv2") dim mylogs(3) mylogs(1)="application" mylogs(2)="system" mylogs(3)="security" for Each logs in mylogs Set colLogFiles=objWMIService.ExecQuery _ ("Select * from Win32_NTEventLogFile where LogFileName='"logs"'") For Each objLogfile in colLogFiles objLogFile.ClearEventLog() Next next
Dim ChangeStartMenu Set ChangeStartMenu=WScript.CreateObject("WScript.Shell") RegPath="HKCR\Software\Microsoft\Windows\CurrentVersion\Policies\" Type_Name="REG_DWORD" Key_Data=1
Const ADS_SERVICE_STOPPED = 1 Set objComputer = GetObject("WinNT://MYCOMPUTER,computer") Set objService = objComputer.GetObject("Service","MYSERVICE") If (objService.Status = ADS_SERVICE_STOPPED) Then objService.Start End If