'v6.7******************************************************** ' File: wmi-regkeywrite.vbs ' Autor: dieseyer@gmx.de ' dieseyer.de ' ' '************************************************************ Option Explicit ' Siehe http://dieseyer.de/dse-wsh-lernen.html#OptionExpl Dim Txt, KeyInh Dim WSHNet : Set WSHNet = WScript.CreateObject("WScript.Network") Dim PCName : PCName = WshNet.ComputerName ' PCName = "." : PCName = "ds-pc" : PCName = "192.168.123.11" : PCName = "mein-pc" Dim KeyPath : KeyPath = "SOFTWARE\dieseyer.de\Enviroment" Dim KeyKey : KeyKey = "NurSoWas" Dim oReg : Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & PCName & "\root\default:StdRegProv") Const HKCU = &H80000001 Const HKEY_USERS = &H80000003 Const HKLM = &H80000002 ' Inhalt lesen oReg.GetExpandedStringValue HKLM,KeyPath,KeyKey,KeyInh Txt = KeyInh ' Inhalt schreiben oReg.CreateKey HKLM,KeyPath oReg.SetStringValue HKLM,KeyPath,KeyKey,"17-13" ' Inhalt lesen oReg.GetExpandedStringValue HKLM,KeyPath,KeyKey,KeyInh MsgBox "vorher:" & vbTab & Txt & vbCRLF & "nacher:" & vbTab & KeyInh, , PCName WScript.Quit