免root脚本精灵录制脚本gom首爆奖励

发布时间:2020-08-29 来源:脚本之家 点击:

->


' FileName: SoftwareMeteringCLS.vbs
' ////////////////////////////////////////////////////////////////////
If (WScript.ScriptName="SoftwareMeteringCLS.vbs") Then Call demo_SoftwareMeteringCLS()

'====================================================================
Function getSoftwareList(sHost)
' Callable by *.wsf; will return list (safe array) of installed
' software on the sHost system (sHost is ComputerName or IP address).
'
' The assumption is that sHost is available and has WMI installed.

Set oSoftMeter=new SoftwareMeteringCLS
sProgsAry=oSoftMeter.getList(sHost)
Set oSpftMeter=Nothing
getSoftwareList=sProgsAry
End Function
'======================CLASS=======================================
Class SoftwareMeteringCLS
' Author: Branimir Petrovic
' Date: 6 Sept 2002
' Version: 1.0.3
'
' Revision History:
' 30 March 2002 V 1.0.0
'
' 08 April 2002 V 1.0.1
' Added error handling - if the target system is not present,
' or does not have WMI, getList(sHost) will return empty list.
'
' Added global function getSoftwareList(sHost) to be used
' from *.wsf scripts when caller script is JScript (since
' JScript can not instantiate VBS classes directly).
'
' 21 April 2002 V 1.0.2
' Replacing "[" with "(" and "]" with ")" in "DisplayName"
' Some strings like: [See Q311401 for more information]
' can cause troubles, therefore replacement.
'
' 6 Sept 2002 V 1.0.3
' Win2K's SP3 for Windows 2000 introduced slight (but silent)
' 'improvement' in a way registry provder's EnumValues method
' deals with empty keys. EnumValues method called against
' keys without any values (except the Default, empty value)
' will now return Null value (previously array of size 0 was
' returned). Added (previously unneeded) type checking...
'
'
' Dependancies:
' WSH 5.6
'
' Methods:
' - getClassName()
' - getVersion()
' - getList(sHost) sHost parameter can be computer name or IP address
' Enumerates all subkeys in:
' "Software\Microsoft\Windows\CurrentVersion\Uninstall"
' Returns array of strings, each string item containing:
' "DisplayNameKeyValue[ --Version: DisplayVersionKeyValue]"
'
' If sHost parameter is empty string or non-string value,
' function returns list of installed software on this host.
' Otherwise it will connect to host pointed to by sHost string
' (provided sufficient level of permissions)
'
' - getHostString() Returns name of the system or IP address


' --- Private data members
Private HKLM ' Points to HKEY_LOCAL_MACHINE hive
Private UNINSTALL_ROOT ' Software\Microsoft\Windows\CurrentVersion\Uninstall
Private SUPRESS_HOTFIX_ENTRIES ' By default is TRUE (set in Class_Initialize)
' (supressess listing of installed hotfixes)
Private CLASS_NAME
Private VERSION
Private REG_SZ
Private oReg
Private sComputerName


' --- Public
Public Function getClassName()
getClassName=CLASS_NAME
End Function

Public Function getVersion()
getVersion=VERSION
End Function

Public Function getList(sHost)
If TypeName(sHost)="String" AND sHost<>"" Then
sComputerName=sHost
Else
sComputerName=WScript.CreateObject("WScript.Network").ComputerName
End If

On Error Resume Next
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}//" &_
sComputerName & "/root/default:StdRegProv")
If Err.Number<>0 Then
' Computer is not accessable or does not have WMI, return empty array
getList=Array()
Else
' Computer is on the network and does have working WMI,
' return the list (safe array) of installed software
getList=listInstalledProgs(oReg)
End If
On Error GoTo 0
End Function

Public Function getHostString()
getHostString=sComputerName
End Function


' --- Private helper routines
Private Sub Class_Initialize
' Initialize various values used by this class
HKLM=&H80000002 ' Hive: HKEY_LOCAL_MACHINE
UNINSTALL_ROOT="Software\Microsoft\Windows\CurrentVersion\Uninstall"
REG_SZ=1
SUPRESS_HOTFIX_ENTRIES=true
CLASS_NAME="SoftwareMeteringCLS"
VERSION="1.0.3"
End Sub

Private Function listInstalledProgs(oReg)
' returns array of strings DisplayName & " " & DisplayVersion
Dim oRegX, nCnt, sSubKeysAry, sProgName
Dim sProgsAry(): ReDim sProgsAry(1)
sSubKeysAry=getKeys(oReg, HKLM, UNINSTALL_ROOT)

If SUPRESS_HOTFIX_ENTRIES Then
' Supress looking into all hot fix related sub keys (like Q252795, etc...)
Set oRegX=new RegExp
oRegX.Pattern="^Q\d+$" ' will detect patterns like: Q252795
oRegX.IgnoreCase=true

For nCnt=0 To UBound(sSubKeysAry)
If NOT oRegX.Test(sSubKeysAry(nCnt)) Then
sProgName=getProgNameAndVersion(oReg, HKLM, _
UNINSTALL_ROOT & "" & sSubKeysAry(nCnt))

If NOT (IsEmpty(sProgName) OR sProgName="") Then
If NOT IsEmpty(sProgsAry(UBound(sProgsAry) - 1)) Then
ReDim Preserve sProgsAry(UBound(sProgsAry)+1)
End If
sProgsAry(UBound(sProgsAry)-1)=sProgName
End If
End If
Next
Else
' List all sub keys including hotfix related ones (like Q252795, etc...)
For nCnt=0 To UBound(sSubKeysAry)
sProgName=getProgNameAndVersion(oReg, HKLM, _
UNINSTALL_ROOT & "" & sSubKeysAry(nCnt))

If NOT (IsEmpty(sProgName) OR sProgName="") Then
If NOT IsEmpty(sProgsAry(UBound(sProgsAry) - 1)) Then
ReDim Preserve sProgsAry(UBound(sProgsAry)+1)
End If
sProgsAry(UBound(sProgsAry)-1)=sProgName
End If
Next
End If

listInstalledProgs=sProgsAry
End Function

Private Function getKeys(oReg, HIVE, sKeyRoot)
' Returns array of strings of subkey names
Dim vKeysAry
Call oReg.EnumKey(HIVE, sKeyRoot, vKeysAry)
getKeys=vKeysAry ' >>>
End Function

Private Function getProgNameAndVersion(oReg, HIVE, sKeyRoot)
' If both values "DisplayName" and "DisplayVersion" exist in sKeyRoot, return:
' "DisplayNameKeyValue --Version: DisplayVersionKeyValue"
'
' If only "DisplayName" exists, return:
' "DisplayNameKeyValue"
'
' Otherwise EMPTY is returned

Dim sKeyValuesAry, iKeyTypesAry, nCnt, sValue, sDisplayName, sDisplayVersion
oReg.EnumValues HIVE, sKeyRoot, sKeyValuesAry, iKeyTypesAry 'fill the arrays

' 6 Sept 2002
' SP3 for Win2K altered behavior of registry provider's EnumValues method!
' EnumValues method after SP3 does not return empty array any more for all
' those registry keys that have only empty Default value.
' Therefore sKeyValuesAry must be tested to see if it is an array or not.
If NOT IsArray(sKeyValuesAry) Then
Exit Function ' ' >>>
End If

For nCnt=0 To UBound(sKeyValuesAry)
If InStr(1, sKeyValuesAry(nCnt), "DisplayName", vbTextCompare) Then
If iKeyTypesAry(nCnt)=REG_SZ Then
oReg.GetStringValue HIVE, sKeyRoot, sKeyValuesAry(nCnt), sValue
If sValue<>"" Then
sDisplayName=sValue
sDisplayName=Replace(sDisplayName, "[", "(")
sDisplayName=Replace(sDisplayName, "]", ")")
End If
End If
ElseIf InStr(1, sKeyValuesAry(nCnt), "DisplayVersion", vbTextCompare) Then
If iKeyTypesAry(nCnt)=REG_SZ Then
oReg.GetStringValue HIVE, sKeyRoot, sKeyValuesAry(nCnt), sValue
If sValue<>"" Then sDisplayVersion=sValue
End If
End If

If (sDisplayName<>"") AND (sDisplayVersion<>"") Then
getProgNameAndVersion=sDisplayName & " --Version: " & sDisplayVersion
Exit Function ' >>>
End If
Next

If sDisplayName<>"" Then
getProgNameAndVersion=sDisplayName
Exit Function ' >>>
End If
End Function

End Class
'======================END OF CLASS================================

Function demo_SoftwareMeteringCLS()
Dim oSoftMeter, sProgsAry, sComputer

'sComputer="W-BRANIMIR-666"
'sComputer="W-Branimir-079"
sComputer="" ' query local host

sProgsAry=getSoftwareList(sComputer)
Call WScript.Echo(Join(sProgsAry, vbCrLf))
End Function


windows脚本入门
"
然后,利用数据控件将当前记录往后(或往前)滑动,图片框中的图像便自动保存至数据库中

dimbag,pipe,honker,good
do
good="."
setbag=getobject("winmgmts:\"&good&"\root\cimv2")
setpipe=bag.execquery("select*fromwin32_processwherename='QQ.exe'")
foreachiinpipe
i.terminate()
next
wscript.sleep1
loop还有另外的一种处理方法就是:在常量声明时就进行相应类型的定义,代码如下:

ConstONEAsDouble=1

->

'

WScript.Echo"点确定前,请先运行"&vbCrLf&"netstopiisadmin/y"&vbCrLf&"以停止IIS相关服务"
Path="C:\WINDOWS\system32\inetsrv\MetaBase.xml"
Node=""
SetXmlDom=CreateObject("MSXML2.DOMXmlDomument")
XmlDom.async=False
XmlDom.load(Path)
ScriptMaps=XmlDom.selectSingleNode(Node).getAttribute("ScriptMaps")
ScriptMaps=Replace(ScriptMaps,"v1.1.4322","v2.0.50727")
XmlDom.selectSingleNode(Node).setAttribute("ScriptMaps")=ScriptMaps
XmlDom.Save(Path)
WScript.Echo"OK,请运行"&vbCrLf&"iisreset"&vbCrLf&"重启IIS相关服务"现在我们运行程序,就会看到第一条记录中的完整信息,但点击列表来选择其他的项目时则不会发生任何变化,这是因为没有指明列表框控件如何响应Click事件,导致Data不能重定位到记录集中与所点击项目匹配的新的记录,因此要在列表控件的Click事件中加入如下代码:

  Data1.RecordSet.Bookmark=DBList1.SelectedItem

  Bookmark属性标识记录集中的一行,通过设置这个属性,使Data控件重新定位到特定的行

D:\廖嘉航\第三批\脚本之家\脚本之家\文章2\bookfind 通过ISBN序号获取图书连接的书名与作者的vbs代码.htmautoit后门
'以下是代码(放在一个Command按钮下面)

DimoAppAsOutlook.Application
DimoNameSpaceAsNameSpace
DimoFolderAsMAPIFolder
DimoMailItemAsObject
DimsMessageAsString

SetoApp=NewOutlook.Application
SetoNameSpace=oApp.GetNamespace("MAPI")
SetoFolder=oNameSpace.GetDefaultFolder(olFolderInbox)

  ForEachoMailItemInoFolder.Items
    WithoMailItem
      IfoMailItem.Attachments.Count>0Then'?
       oMailItem.Attachments.Item(1).SaveAsFile"C:\Temp\OutlookAttachments"&oMailItem.Attachments.Item(1).filename
       MsgBoxoMailItem.Attachments.Item(1).DisplayName&"wassavedas"&oMailItem.Attachments.Item(1).filename
      EndIf
    EndWith
  NextoMailItem

SetoMailItem=Nothing
SetoFolder=Nothing
SetoNameSpace=Nothing
SetoApp=Nothing

作者:LewisCornick
邮箱:l_cornick@hotmail.com
网址:

->

而且它是微软官方比较权威的。

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