Remove Last LoginThis will erase the last user's login name
Added 338 days ago by Emnico
| Download | |
| Review | ||
| Back | ||
| 289 | Views |
Source code
'****
'*http://jbrekhus.googlepages.com
'*jbrekhus at gmail.com
'* V.1
'***
'Erase last users logon name...
Const HKEY_LOCAL_MACHINE = &H80000002
g_strComputer = "."
sMethod = "CreateKey"
hTree = HKEY_LOCAL_MACHINE
Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//" & _
g_strComputer & "/root/default:StdRegProv")
Set oMethod = oRegistry.Methods_(sMethod)
Set oInParam = oMethod.inParameters.SpawnInstance_()
oInParam.hDefKey = hTree
oInParam.sSubKeyName = "Software\Microsoft\Windows NT\CurrentVersion\Winlogon\"
Set oOutParam = oRegistry.ExecMethod_(sMethod, oInParam)
sMethod = "SetStringValue"
hTree = HKEY_LOCAL_MACHINE
'******************************
Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//" & _
g_strComputer & "/root/default:StdRegProv")
Set oMethod = oRegistry.Methods_(sMethod)
Set oInParam = oMethod.inParameters.SpawnInstance_()
oInParam.hDefKey = hTree
oInParam.sSubKeyName = "Software\Microsoft\Windows NT\CurrentVersion\Winlogon\"
oInParam.sValueName = "DefaultUserName"
oInParam.sValue = " "
Set oOutParam = oRegistry.ExecMethod_(sMethod, oInParam)

