oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
oReg.SetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
oReg.SetBinaryValue HKEY_LOCAL_MACHINE,strPath,strValueName,uBinary
oReg.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrStringValues
oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName
oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,uBinary
oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrStringValues
'-------------------------------------------------------------------------------------------
Const HKEY_CLASSES_ROOT = H80000000
Const HKEY_CURRENT_USER = H80000001
Const HKEY_LOCAL_MACHINE = H80000002
Const HKEY_USERS = H80000003
Const HKEY_CURRENT_CONFIG = H80000005
' 創(chuàng)建注冊(cè)表項(xiàng)
const HKEY_LOCAL_MACHINE = H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
strComputer "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\System Admin Scripting Guide"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
'創(chuàng)建多字符串值
const HKEY_LOCAL_MACHINE = H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
strComputer "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\System Admin Scripting Guide"
strValueName = "Multi String Value Name"
arrStringValues = Array("first string", "second string",_
"third string", "fourth string")
oReg.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,arrStringValues
'創(chuàng)建擴(kuò)展的字符串值
const HKEY_LOCAL_MACHINE = H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
strComputer "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\System Admin Scripting Guide"
strValueName = "Expanded String Value Name"
strValue = "%PATHEXT%"
oReg.SetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'創(chuàng)建字符串和 DWORD 值
const HKEY_LOCAL_MACHINE = H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
strComputer "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\System Admin Scripting Guide"
strValueName = "String Value Name"
strValue = "string value"
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strValueName = "DWORD Value Name"
dwValue = 82
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
'刪除注冊(cè)表項(xiàng)
const HKEY_LOCAL_MACHINE = H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
strComputer "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\System Admin Scripting Guide"
oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
'刪除注冊(cè)表值
const HKEY_LOCAL_MACHINE = H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
strComputer "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\System Admin Scripting Guide"
strDWORDValueName = "DWORD Value Name"
strExpandedStringValueName = "Expanded String Value Name"
strMultiStringValueName = "Multi String Value Name"
strStringValueName = "String Value Name"
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strDWORDValueName
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strExpandedStringValueName
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strMultiStringValueName
oReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strStringValueName
'枚舉注冊(cè)表值和類型
'枚舉子項(xiàng)
'列出注冊(cè)表文件
'監(jiān)視注冊(cè)表子項(xiàng)事件
'監(jiān)視注冊(cè)表子樹(shù)事件
'讀取二進(jìn)制注冊(cè)表值
const HKEY_LOCAL_MACHINE = H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
strComputer "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
strValueName = "LicenseInfo"
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,strValue
For i = lBound(strValue) to uBound(strValue)
StdOut.WriteLine strValue(i)
Next
12下一頁(yè)閱讀全文
您可能感興趣的文章:- VB中使用WMI獲取系統(tǒng)硬件和軟件有關(guān)信息
- VBS調(diào)用WMI遍歷搜索硬盤文件并計(jì)數(shù)的方法
- vbs通過(guò)WMI修改文件文件夾的NTFS權(quán)限
- WMI StdRegProv 通過(guò)wmi操作注冊(cè)表的vbscript實(shí)現(xiàn)代碼 (本地或遠(yuǎn)程)
- VBS通過(guò)WMI監(jiān)視注冊(cè)表變動(dòng)的代碼
- VBS通過(guò)WMI獲取CPU使用率的代碼
- 將WMI中的DateTime類型轉(zhuǎn)換成VBS時(shí)間的函數(shù)代碼
- VBS調(diào)用WMI實(shí)現(xiàn)搜索硬盤mp3文件
- Rcmd.vbs [Remote Cmd with wmi]遠(yuǎn)程腳本
- VBS調(diào)用WMI快速關(guān)閉IE的腳本
- vbs wmi獲取電腦硬件信息實(shí)例
- 初窺WMI_Vbs腳本編程簡(jiǎn)明教程補(bǔ)充讀物
- 使用WMI得到計(jì)算機(jī)的信息