Can someone please help me how can I achieve this using powershell
I am trying to delete the user profile from registry "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" and also assocaited guid from “HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileGuid”.
The commands are equivalent. So one of them is enough. And in this special case you should choose the first one. Do not use Get-WMIObject anymore.
Here you have a little more complete description:
Regardless of that - PLEASE format error messages as code using the preformatted text button ( </> ). Just like you do with code. As you can see when you review your own post the forum software will cut some charachters and symbols when you don’t use the proper formatting.
It says the file is in use and I am unable to delete the NTUSER.DAT in user profile C:\users\username as well as it says the file is opened by SYSTEM and unable to delete it.
Tried rebooting the machine and stopping Symantec protection, but still it’s same.
Actually, there are many profiles that are to be deleted. So using CIMInstance command it’s the same. It says file is in use.