This is the script I have ============================================================ Const HKEY_CURRENT_USER = &H80000001 strComputer = CreateObject("Wscript.Shell").Environment("Process")("ComputerName") 'strComputer = "." Dim strKey strKey = "HKEY_CURRENT_USER\Software" If Not RegKeyExists(strKey) Then 'WScript.Echo "Key Is NOT Present!" Else 'WScript.Echo "Key IS Present." Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _ strComputer & "\root\default:StdRegProv") strKeyPath = "Software\Microsoft\Windows NT" oReg.EnumKey HKEY_CURRENT_USER, strKeyPath, arrSubKeys For Each subkey In arrSubKeys 'Wscript.Echo strKeyPath & "\" & subkey oReg.DeleteKey HKEY_CURRENT_USER, strKeyPath & "\" & subkey Next 'Wscript.Echo strKeyPath oReg.Deletekey HKEY_CURRENT_USER, strKeyPath End If Function RegKeyExists(strName) Const NO_EXISTING_KEY = "HKEY_NO_EXISTING\Key\" Dim objWsh Dim strKeyPath Dim strNoKeyError Set objWsh = WScript.CreateObject("WScript.Shell") strKeyPath = Trim(strName) If Right(strKeyPath, 1) <> "\" Then strKeyPath = strKeyPath & "\" On Error Resume Next ' Get the error description by trying to read a non-existent key objWsh.RegRead NO_EXISTING_KEY strNoKeyError = Err.Description Err.Clear objWsh.RegRead strKeyPath ' Compare the error description with the previous determined sample If Replace(Err.Description, strKeyPath, NO_EXISTING_KEY) = strNoKeyError Then RegKeyExists = False Else RegKeyExists = True End If Err.Clear On Error Goto 0 Set objWsh = Nothing End Function =========================================================== The script runs on a single pc but its not working through login script, any examples on how to write a a reg file and run it through a batch file. is reg file going to delete all the subkeys below as they need to be empty before the main key gets deleted.