Windows 7 Thread, Delprof in Technical; Hi, Is there a utility to delete the profiles in Windows 7 like with XP? The windows XP utility doesn't ...
1. ## Delprof

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.

2. This can be done through GPO alternatively you could use Delprof2 which I've used recently.

3. ## 2 Thanks to penfold:

gmonks (8th October 2012), timzim (15th November 2012)

4. 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.

5. Originally Posted by penfold
This can be done through GPO alternatively you could use Delprof2 which I've used recently.
+1 we Delprof2 on Windows 7, seems to work well.

6. ## Thanks to Ashm from:

gmonks (8th October 2012)

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

Code:
```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```

8. Originally Posted by penfold
This can be done through GPO alternatively you could use Delprof2 which I've used recently.
Thank you, I will try this.

SHARE: