Emnico in Swindon and its partners
in the UK and Europe provide:

» IT Support Services and Products
» Bespoke Software Development


Contact our Swindon office on:
+44 (0)1793 614 700
to discuss your IT needs.


CLOSE IT
Emnico Logo
Your Virtual Technology Team
Delivering Peak Performance
Category: Type: Order:
Search For:  
Home > Library > Remove Last Login

Remove Last Login

This will erase the last user's login name
Added 338 days ago by Emnico
Download
Review
Back
289Views
This script or application has not been checked by Emnico. Make sure you understand the risks before using it.

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)


| Privacy policy | Environmental policy | Site map |