Restore User Registry

Today I did a bad mistake on a user machine. After loading the user’s HKCU in regedit to check for some settings, I accidentally deleted it. After that, the user cannot login to the machine because her profile was corrupted. I tried to run the system restore but that did not help at all. Ah…

I finally found out a way to fix this problem. The idea is to delete the user’s profile and re-create it.


After deleted the profile, I rebooted the machine then asked the user to login. She was able to log back in without any problem. The only thing she lost was her recent opened applications under the start menu.





Remove a printer

In our Microsoft Office 365 v2016 C2R deployment , we have to delete the local “Send To OneNote 2013” printer. This printer was created when we installed Office 2013. After a little bit of searching, I found out 3 ways to delete a printer.

  1. Using command line

You can use the command to remove a printer.

Local printer:
rundll32 printui.dll,PrintUIEntry /dl /n “printer-name” /q

Network printer:
rundll32 printui.dll,PrintUIEntry /dn /n “printer-name” /q

/dl: delete local printer
/n: printer name
/q: quiet

To see all the options, run this command:
rundll32 printui.dll,PrintUIEntry /?

2. Using vbscript

This script scans all local printers on the system then remove the “Fax” printer. Modify the wmi query to get the network or all printers if needed.

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
Set colInstalledPrinters = objWMIService.ExecQuery(“Select * from Win32_Printer where Network = FALSE”)
For Each objPrinter in colInstalledPrinters
 If StrComp(Trim(objPrinter.Name), “Fax”) = 0 Then 
 End If

3. Using PowerShell

This script removes the network printers only. Modify the if statement to remove local or all printers if needed.

$printers = Get-WmiObject -Class win32_printer
foreach ($printer in $printers)
#Remove only network printers
if($printer.Name -ne $null -and $printer.Name.StartsWith(“\\”))