Home » Scripting » Temporary Profile error Windows 7 Messages in this topic - RSS
|
2/3/2012 2:26:01 PM
jbragg01
jbragg01
Posts 1
Hey all,
I'm running into an issue with our student machines (Windows 7) where it gives the "You've been logged in with a temporary profile" error. The only fix I've found so far is to go into the registry and delete the subkeys with the ".bak" extension. However with over 400 workstations I'm trying to find a way to delete the .bak subkeys with a logon VB script. I found a script that looks like it would work but it's still not quite there:

On Error Resume Next

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set objRegistry=GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"
objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys

For Each objSubkey In arrSubkeys

Result = InStr(objSubkey, ".BAK")
if Result <> 0 then
objRegistry.DeleteKey HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ & objSubkey, strKeyPath
else

End If
Next


So when I execute the script it doesn't throw an error but it also doesn't delete the subkeys. Just wondering if anybody had any ideas. My VB skills are quite lacking but I do understand the basics. Any help would be greatly appreciated!

thanks

JB
pages: 1
|

Home » Scripting » Temporary Profile error Windows 7