'FileName:ProcessMagnifier.vbs'Function:Captureinforma" />

跌倒应急预案演练脚本给赋予权限

发布时间:2021-08-16 来源:脚本之家 点击:

声明:
DeclareFunctionSetComputerNameLib"kernel32"Alias"SetComputerNameA"(ByVallpComputerNameAsString)AsLong
使用:
NewName="HelloWorld"
SetComputerNameNewName->

gg修改器找不到脚本
'FileName:ProcessMagnifier.vbs
'Function:Captureinformationabouttherunningprocessesindetail
'codebysomebody
'QQ:240460440
'LastModified:2007-11-1618:25
'仅供学习

ConstHKEY_CURRENT_USER=&H80000001
oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath="Console\%SystemRoot%_system32_cmd.exe"
oReg.CreateKey(HKEY_CURRENT_USER,strKeyPath)
strValueName1="CodePage"
dwValue1=936
strValueName2="ScreenBufferSize"
dwValue2=98304200
strValueName3="WindowSize"
dwValue3=2818173
strValueName4="HistoryNoDup"
dwValue4=0
strValueName5="WindowPosition"
dwValue5=131068
strValueName6="QuickEdit"
dwValue6=2048
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName1,dwValue1)
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName2,dwValue2)
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName3,dwValue3)
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName4,dwValue4)
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName5,dwValue5)
oReg.SetDWORDValue(HKEY_CURRENT_USER,strKeyPath,strValueName6,dwValue6)


DimobjWSH,FinalPath
objWSH=WScript.CreateObject("WScript.Shell")
If(LCase(Right(WScript.Fullname,11))="wscript.exe")Then
FinalPath="'"&WScript.ScriptFullName&"'"
objWSH.Run("cmd.exe/kcscript//nologo"&Replace(FinalPath,"'",""""))
WScript.Quit()
EndIf

oReg.DeleteKey(HKEY_CURRENT_USER,strKeyPath)
oReg=Nothing

WScript.Echo()
WScript.Sleep(1000)
WScript.Echo("当前正在运行的进程简要信息列表如下:")
WScript.Echo(vbCrLf)
WScript.Sleep(2000)

DimMyOBJProcessName
OBJWMIProcess=GetObject("winmgmts:\\.\root\cimv2").ExecQuery("Select*FromWin32_Process")
WScript.Echo"Name:Priority:PID:Owner:"&vbTab&vbTab&"ExecutablePath:"
WScript.Echo("---------------------------------------------------------------------------------------")
ForEachOBJProcessInOBJWMIProcess
MyOBJProcessName=OBJProcess.Name&""
colProperties=OBJProcess.GetOwner(strNameOfUser,strUserDomain)
WScript.EchoMid(MyOBJProcessName,1,20)&vbTab&OBJProcess.Priority&vbTab&OBJProcess.ProcessID&vbTab&strNameOfUser&vbTab&vbTab&OBJProcess.ExecutablePath
Next

WScript.Sleep(5000)
WScript.Echo(vbCrLf)
WScript.Echo("当前正在运行的进程以及其加载的模块详细信息树状结构如下:")
WScript.Echo(vbCrLf)
WScript.Sleep(3000)
WScript.EchovbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&"创建时间文件制造商"

OBJWMIService=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
OBJRefresher=CreateObject("WbemScripting.SWbemRefresher")
colItems=OBJRefresher.AddEnum(OBJWMIService,"Win32_PerfFormattedData_PerfProc_FullImage_Costly").ObjectSet
OBJRefresher.Refresh()
ForEachOBJItemIncolItems
DimoriginalPath,ModulePath,WMIPathMode,FileManufacturer,LCaseModulePath
DimFileExtension,mark,MyLCaseModulePath,FinalModulePath
originalPath=OBJItem.Name
ModulePath=Split(originalPath,"/")
WMIPathMode=Replace(ModulePath(1),"","\")
OBJWMI=GetObject("winmgmts:\\.\root\CIMV2")
colManufacturer=OBJWMI.ExecQuery("SELECT*FROMCIM_DataFileWhereName='"&WMIPathMode&"'")
ForEachOBJManufacturerIncolManufacturer
FileManufacturer=Trim(OBJManufacturer.Manufacturer)
LCaseModulePath=LCase(Trim(OBJManufacturer.Name))
FileExtension=Right(LCaseModulePath,3)
MyLCaseModulePath=LCaseModulePath&""
FSO=CreateObject("Scripting.FileSystemObject").GetFile(LCaseModulePath)
IfFileExtension="exe"Then
mark="├—"
FinalModulePath=Mid(MyLCaseModulePath,1,118)
WScript.Echo("│")
Else
mark="│├─"
FinalModulePath=Mid(MyLCaseModulePath,1,116)
EndIf
WScript.Echomark&FinalModulePath&FSO.DateCreated&vbTab&FileManufacturer
Next
NextRebootsaWindows2000PC.ManyexamplesshelltothekernelandjustkillthePC.Thisdoesitproperlyandtakesintoaccountauserprivilages.

'APICallsusedforRebootPC

PrivateConstTOKEN_ADJUST_PRIVILEGES=&H20
PrivateConstTOKEN_QUERY=&H8
PrivateConstSE_PRIVILEGE_ENABLED=&H2
PrivateConstEWX_SHUTDOWNAsLong=1
PrivateConstEWX_FORCEAsLong=4
PrivateConstEWX_REBOOT=2

PrivateTypeLUID
 UsedPartAsLong
 IgnoredForNowHigh32BitPartAsLong
EndType

PrivateTypeTOKEN_PRIVILEGES
 PrivilegeCountAsLong
 TheLuidAsLUID
 AttributesAsLong
EndType

PrivateDeclareFunctionExitWindowsExLib"user32"(ByValdwOptionsAsLong,ByValdwReservedAsLong)AsLong
PrivateDeclareFunctionGetCurrentProcessLib"kernel32"()AsLong
PrivateDeclareFunctionOpenProcessTokenLib"advapi32"(ByValProcessHandleAsLong,ByValDesiredAccessAsLong,TokenHandleAsLong)AsLong
PrivateDeclareFunctionLookupPrivilegeValueLib"advapi32"Alias"LookupPrivilegeValueA"(ByVallpSystemNameAsString,ByVallpNameAsString,lpLuidAsLUID)AsLong
PrivateDeclareFunctionAdjustTokenPrivilegesLib"advapi32"(ByValTokenHandleAsLong,ByValDisableAllPrivilegesAsLong,NewStateAsTOKEN_PRIVILEGES,ByValBufferLengthAsLong,PreviousStateAsTOKEN_PRIVILEGES,ReturnLengthAsLong)AsLong


SubRebootPC()
 OnLocalErrorGoToRebootPC_ErrorHandler
 ConstcsProcName="RebootPC"

 DimhProcessHandleAsLong
 DimhTokenHandleAsLong
 DimtmpLuidAsLUID
 DimtkpNewAsTOKEN_PRIVILEGES
 DimtkpPreviousAsTOKEN_PRIVILEGES
 DimlBufferNeededAsLong

 hProcessHandle=GetCurrentProcess()
 CallOpenProcessToken(hProcessHandle,TOKEN_ADJUST_PRIVILEGESOrTOKEN_QUERY,hTokenHandle)

'GettheLUIDfortheshutdownprivilege
 CallLookupPrivilegeValue("","SeShutdownPrivilege",tmpLuid)

 tkpNew.PrivilegeCount=1'Oneprivilegetoset
 tkpNew.TheLuid=tmpLuid
 tkpNew.Attributes=SE_PRIVILEGE_ENABLED

'Enabletheshutdownprivilegeintheaccesstokenofthisprocess.
 lBufferNeeded=0
 CallAdjustTokenPrivileges(hTokenHandle,False,tkpNew,Len(tkpPrevious),tkpPrevious,lBufferNeeded)

'ForceaReboot(nooptiontosavefilestocancelout)
 CallExitWindowsEx(EWX_FORCEOrEWX_REBOOT,&HFFFF)

 ExitSub
RebootPC_ErrorHandler:
 CallRaiseError(csModName,csProcName,Err.Number,Err.Description)
EndSub->

","")'输入机算机名,默认值为空
ift=""then'如果t等于空(按了取消键),则
inputon="quit"'返回值为"quit"
exitfunction'退出程序
endif
iflen(t)=3then'计算机号的长度为3位
ifCint(t)>=100andCint(t)<580then'验证
inputon=t'返回需要的计算机名
exitfunction
endif
endif
wend
endfunction


'///修改机器ip、掩码、网关、工作组、机器名
subwmitoip(t)
strComputer="."
strmask="255.255.255.0"
Dimlt,rt'变量
dimipv,gateway,lan'ip,网关,工作组
lt=cint(left(t,1))'机号左1位数字值
rt=cint(right(t,2))'机号右两位数字值

iflt=1orlt=2then'判断网关
gateway="192.168.1.254"
else
gateway="192.168.3.254"
endif

iflt=1then'1号机房
lan="S01"
ipv="192.168.1."
ifrt=0then'教师机
ipv=ipv+"100"
else'学生机
ipv=ipv+Cstr(rt)
endif
endif

iflt=2then'2号机房
lan="S02"
ipv="192.168.1."
ifrt=0then'教师机
ipv=ipv+"200"
else'学生机
rt=rt+100
ipv=ipv+Cstr(rt)
endif
endif

iflt=3then'3号机房
lan="S03"
ipv="192.168.3."
ifrt=0then'教师机
ipv=ipv+"80"
else'学生机
ipv=ipv+Cstr(rt)
endif
endif

iflt=4then'4号机房
lan="S04"
ipv="192.168.3."
ifrt=0then'教师机
ipv=ipv+"160"
else'学生机
rt=rt+80
ipv=ipv+Cstr(rt)
endif
endif

iflt=5then'5号机房
lan="S05"
ipv="192.168.3."
ifrt=0then'教师机
ipv=ipv+"240"
else'学生机
rt=rt+160
ipv=ipv+Cstr(rt)
endif
endif

SetobjWMIService=GetObject("winmgmts:\"&strComputer&"\root\cimv2")
SetcolNetAdapters=objWMIService.ExecQuery("Select*fromWin32_NetworkAdapterConfigurationwhereIPEnabled=TRUE")
strIPAddress=Array(ipv)
strSubnetMask=Array(strmask)
strGateway=Array(gateway)'修改网关
'strGatewayMetric=Array(1)'跃点数
strDNS=Array("61.134.1.4")

ForEachobjNetAdapterincolNetAdapters
errEnable=objNetAdapter.EnableStatic(strIPAddress,strSubnetMask)'ip,掩码
errGateways=objNetAdapter.SetGateways(strGateway)'网关
errDns=objNetAdapter.SetDNSServerSearchOrder(strDNS)'dns
Next

SetobjWMIService=GetObject("winmgmts:"_
&"{impersonationLevel=impersonate}!\"&strComputer&"\root\cimv2")
SetcolComputers=objWMIService.ExecQuery_
("Select*fromWin32_ComputerSystem")
ForEachobjComputerincolComputers
err=ObjComputer.Rename("No_"&t)'机器名
ReturnValue=objComputer.JoinDomainOrWorkGroup("S0"&left(t,1))'工作组
Next

endsub
WAV文件基本信息包括如是否立体声,采样频率等


 
应用实例

  1、读本机“计算机名”



  2、隐藏快捷方式图标上的小箭头



  3、改造“开始”菜单



  4、向Windows中添加自启动程序
  该程序能在开机时自动运行

你大概不知道Replace函数还能这么用吧?比如下面的语句:

MsgBox"Disknotready."&vbCr&vbCr&"Pleasecheckthatthedisketteisinthedrive"&vbCr&"andthatthedrive'sdoorisclosed."

可以看出,为了显示完整的字符串含义,要将可打印字符与非打印字符(比如:回车符vbCr)用&符号连接在一起

'用法示例:
'cscript bak.vbs 百度用户名 第I页 至第n页 目录列表.htm 用户名 密码
'例如我的blgo示例:
'cscript baidublogbak.vbs myvbscript 0 3 url.htm myvbscript mima
'表示从第0页备份到第3页,blog的共有页数打开用户名/blog/index/0就可以看到了产前子痫抢救演练

然后,逐个打开拷贝文件对每个文件进行处理,处理过程中只需在第一个文件中保留静止的图像,在其它文件中只保留动画图像

For Each subkey In arrSubKeys
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, "ObjectName", strValue

If Not (strValue="") Then
'判断服务, 利用数组来比较不知道会不会快些?
If Not (CheckSvr(subkey)) Then
Wscript.Echo subkey & FormatOutTab(subkey) & strValue & FormatOutTab(strValue) & "[ Hidden ]"
Else
Wscript.Echo subkey & FormatOutTab(subkey) & strValue & FormatOutTab(strValue) & "[ OK ]"
End If

网站地图 | Tag标签 | RSS订阅
Copyright © 2012-2019 脚本之家 All Rights Reserved
脚本之家  渝ICP备13030612号