This tutorial will observe a procedure to delete a user profile using PowerShell.
How to Use/Utilize PowerShell to Delete a User Profile?
The user profile in Windows can be deleted using PowerShell’s “Remove-LocalUser” cmdlet. Before moving forward, first, get the list of the user profiles on Windows by executing the “Get-LocalUser” cmdlet:
Let’s remove the user profile of “John” by executing the below-stated code:
According to the above-stated code:
- First, add the “Remove-LocalUser” cmdlet, specify the “-Name” parameter and then assign the user name to be deleted.
- The “Remove-LocalUser” cmdlet is specially used to delete the user profile on Windows using PowerShell:
Again, run the “Get-LocalUser” cmdlet to verify whether the user profile was deleted or not:
It can be observed that the user profile “John” is not visible in the above list. It is now confirmed that the user profile has been deleted.
Conclusion
To delete a user profile on Windows using PowerShell, first, add the “Remove-LocalUser” cmdlet. Then, add the “-Name” parameter and assign the user profile name within inverted commas to be deleted. Lastly, run the “Get-LocalUser” cmdlet to verify the deletion of the user profile. This post has discussed a method to remove a user profile/account in Windows.