Jump to content

Recommended Posts

Posted

Hi,

 

Is there a utility to delete the profiles in Windows 7 like with XP?

 

The windows XP utility doesn't work in Windows 7.

 

Thanks

 

George.

Posted
We use delprof here on both Windows 7 x86 and x64 (professsional) images and it works no problem as long as you run it from a command prompt that has "run as administrator" privleges.
Posted

I use the following code in a startup VB script, seems to work ok:

 

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ 
					strComputer & "\root\default:StdRegProv")


'root of registry keys
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"

'build collection of keys to check
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

'we now have a collection of subkeys in 'arrSubKeys'
'look inside each key
For Each subkey In arrSubKeys
CheckKey (strKeyPath & "\" & subkey)	
Next


Sub CheckKey (key)
'check the key to see if contains 'CentralProfile" string value (REG_SZ)
objReg.GetStringValue HKEY_LOCAL_MACHINE,key,"CentralProfile",sValue
'if the value is set, then it refers to a central profile and must be deleted
If Not IsNull (sValue) Then
	DeleteKey (key)
End If	
End Sub


Sub DeleteKey (thisKey)
'delete all subkeys
objReg.EnumKey HKEY_LOCAL_MACHINE, thisKey, arrSubKeys
If IsArray (arrSubKeys) Then
	For Each strSubKey In arrSubKeys
		'recursively delete the key
		DeleteKey (thisKey & "\" & strSubKey)
	Next
End If

'delete the registry key
objReg.DeleteKey  HKEY_LOCAL_MACHINE,thisKey
End sub

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...