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