'==============================================================================
'LANG : VBScript
'NAME : computername.vbs
'DESCRIPTION: Changes My Computer to actual Computername
'==============================================================================
Option Explicit
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_PERFORMANCE_DATA = &H80000004
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_DYN_DATA = &H80000006
Const REG_NONE = 0
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_DWORD_LITTLE_ENDIAN = 4
Const REG_DWORD_BIG_ENDIAN = 5
Const REG_LINK = 6
Const REG_MULTI_SZ = 7
Const REG_RESOURCE_LIST = 8
Dim strComputer
Dim objReg
Dim strKeyPath
Dim strValueName
Dim strValue
'==============================================================================
'==============================================================================
'Main Body
On error resume next
strComputer = "."
'wscript.echo "Binding to Registry Provider"
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!" & strComputer & "rootdefault:StdRegProv")
strKeyPath = "CLSID{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
strValueName = "LocalizedString"
strValue = "%COMPUTERNAME%"
'wscript.echo "Setting Registry Key"
objReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath,strValueName,strValue
if Err.Number <> 0 then
wscript.echo ("Error # " & CStr(Err.Number) & " " & Err.Description)
End if
wscript.quit (Err.number)
cute! thank you.
Pingback: Tutorials, photoshop and more - Make My PC Run Faster: Reviews of The Cheapest