How to: Quickly remove printer jobs from Windows, Quickly reset printer jobs

Method 1

1 Save following text to ResetPrinterJob.cmd or ResetPrinterJob.bat

Simple version

rem https://dannyda.com
net stop spooler
del /q /s c:\windows\system32\spool\printers*.*
net start spooler

Verbose version

@echo off
echo dannyda.com
echo(
NET SESSION >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
    ECHO Administrator PRIVILEGES Detected! 
) ELSE (
    ECHO This script has to be run with Administrator PRIVILEGES!
    ECHO(
    ECHO The script will now terminate.
    @pause
    exit
)
echo(
net stop spooler
del /q /s c:\windows\system32\spool\printers.
net start spoolerA
if %ERRORLEVEL% == 0 goto :successful
echo "Errors encountered during execution.  Exited with status: %errorlevel%"
goto :failed
:successful
echo The printer is ready for use again!
@pause
exit
:failed
echo "Script completed with error"
@pause

2 Run ResetPrinterJob.cmd or ResetPrinterJob.bat in Admin mode.

3 Now the printer is ready to be used again.

Method 2

1 Open “Task Manager” by using Ctrl + Alt + Deletekey combination or right click on task bar then click on “Task Manager”

2 Click on “Services” tab

3 Find “Spooler”

4 Right click on it then click on “Stop”

5 Open file explorer navigate to “C:\Windows\system32\spool\PRINTERS”

6 Delete all files within the folder (Do not delete the “C:\Windows\system32\spool\PRINTERS” folder)

7 Bring back the Task Manager, start the Spooler service

8 Now the printer is ready to be used again.


How to: Create/Add/Delete/Remove/List Users/Groups with Command Prompt/Command line in Windows (net command)

Keywords: Windows command prompt, command line, cmd, Add Users, Create Users, Delete Users, Remove Users, List Users, Add local groups, Create local groups, Delete local groups, List local groups, net command

Launch the Command Prompt (In Admin mode)

We should launch the Command Prompt in Administrator mode.

  • Use Win + X key combination -> “Windows PowerShell (Admin)”

or

  • Open start menu -> Type “cmd” -> Right click on “Command Prompt” -> Run as administrator

Add a New User

net user username password /add

net user user1 1234 /add
net user username password /add
net user username password /add

Add a user to a group

net localgroup administrator username /add

e.g. add user to local administrator group

net localgroup administrators user1 /add
net localgroup administrators user1 /add
net localgroup administrators user1 /add

Add a New Local Group

net localgroup newGroupName /add

net localgroup newgroup /add
net localgroup newgroup /add
net localgroup newgroup /add

List All Users

net user

net user
net user
net user

List information about a specific User

net user userName

net user win10
net user win10
net user win10

List All Users with Sid

WMIC useraccount get name

WMIC useraccount get name,sid

WMIC useraccount get name
WMIC useraccount get name,sid
WMIC useraccount get name,sid
WMIC useraccount get name,sid

List All Local Groups

net localgroup

net localgroup
net localgroup
net localgroup

Remove a User from a Local Group

net localgroup groupName userName /delete

net localgroup administrators user1 /delete
net localgroup administrators user1 /delete
net localgroup administrators user1 /delete

Remove a Local Group

net localgroup groupname /delete

net localgroup mygroup /detele
net localgroup mygroup /detele
net localgroup mygroup /detele

Remove a User

net user username /delete

net user user1 /delete
net user user1 /delete
net user user1 /delete

How to: Get User SID in Windows

1 Launch Command Prompt via “Win+X -> Command Prompt or PowerShell”

OR

Via run window (1. Use Win + R key combination to bring up Run window 2. Type “cmd” then hit Enter key)

Microsoft Windows - Run window
Microsoft Windows – Run window

2 Type following command to show current username and SID.

whoami /user

To show all usernames and SIDs

WMIC useraccount get name,sid

To show SID for a specific user

wmic useraccount where name="USER" get sid

e.g.

wmic useraccount where name="Administrator" get sid

How to: Enable/Disable Windows Hello / Windows Hello for Business via Group Policy, Registry, Command Prompt (CMD)

This guide is suitable for both domain joined/Intune Managed and non-domain joined/non-Intune Managed Windows 10.


Table of contents


If you are not sure which kind of Windows 10 you are using, jump to Section 2

1 For Domain Joined / Intune Managed Windows 10

If configuring with domain joined/Intune managed Windows 10, sometimes we want to give the user option to use the Windows Hello or not. Then follow this guide first “Windows 10 Sign-in options and Windows Hello Set up button greyed out After Joined AAD (Azure Active Directory)” After we have done with the above guide (The above guide modify the Windows Hello for Business organisation wide for future enrol Windows 10), next time we have new Windows 10 enrolled to the AAD, the system will request us to setup PIN/Windows Hello or Windows Hello for Business on enrolment but sometimes we don’t want to setup Windows Hello / Windows Hello for Business for some devices. We can follow Section 2 to enable and disable Windows Hello for Business individually.

2 For domain joined/ Intune Managed, non-domain joined/non-Intune managed and all other average users of Windows 10

2.1 Enable and Disable Windows Hello for Business via Group Policy

GUI

2.1.1 Use Win + R to lunch “RUN” window

Microsoft Windows - Run window
Microsoft Windows – Run window

2.1.2 Type gpedit.msc then hit Enter key to open Local Group Policy Editor

Windows 10 Local Group Policy Editor
Windows 10 Local Group Policy Editor

2.1.3 Navigate to “Computer Configuration” -> “Administrative Templates” -> “Windows Components” -> “Windows Hello for Business”

"Computer Configuration" -> "Administrative Templates" -> "Windows Components"
“Computer Configuration” -> “Administrative Templates” -> “Windows Components”
-> "Windows Hello for Business"
-> “Windows Hello for Business”

2.1.4 Double click on “Use Windows Hello for Business”

Double click on "Use Windows Hello for Business"
Double click on “Use Windows Hello for Business”

2.1.5 From the pop-up window, we can Enable or Disable Windows Hello for Business, also Enable or Disable “Do not start Windows Hello provisioning after sign-in”

Enable or Disable Windows Hello for Business
Enable or Disable Windows Hello for Business

To Enable Windows 10 to ask users to setup Windows Hello for Business right after login, we can leave the “Do not start Windows Hello provisioning after sign-in” option unchecked. (Useful for pre-configuration, then deliver to the end user, a form of forcing the end user to setup the Windows Hello for Business, If you have Multi-factor authentication (MFA) configured, it might ask them to configure MFA first before configuring Windows Hello for Business.)

To disable Windows 10 to ask users to setup Windows Hello for Business right after login, we need check the “Do not start Windows Hello provisioning after sign-in” option.

2.2 Enable and Disable Windows Hello for Business via Registry

2.2.1 Follow Step 2.1.1 to 2.1.2, Instead typing “gpedit.msc” we replace it with “regedit”

Windows 10 Registry Editor
Windows 10 Registry Editor

2.2.2 Navigate to “Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork”

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork

2.2.2.1 (If “PassportForWork” Key does not exist, create it manually) Right click on “Microsoft” -> Select “New” -> “Key” -> Name it “PassportForWork”

Create PassportForWork key
Create PassportForWork key

2.2.3 We need to create two Values “Enabled” and “DisablePostLogonProvisioning” Right click on right panel, Select “New” -> “DWORD (32-bit) Value”

Enabled value: 0 = Disabled, 1 = Enabled

DisablePostLogonProvisioning value: 0 = Disabled, 1 = Enabled

Create "Enabled" and "DisablePostLogonProvisioning" DWORD
Create “Enabled” and “DisablePostLogonProvisioning” DWORD

(To change it to “Not Configured”, we can just delete the “PassportForWork” Key)

.reg file

Save following as “filename.reg” file then double click and import will have same effect

  • Enable “Windows Hello for Business” and “Start Windows Hello provisioning after sign-in”
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork]
"Enabled"=dword:00000001
"DisablePostLogonProvisioning"=dword:00000000

  • Enable “Windows Hello for Business” but “Do not start Windows Hello provisioning after sign-in”
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork]
"Enabled"=dword:00000001
"DisablePostLogonProvisioning"=dword:00000001

  • Disable “Windows Hello for Business”
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork]
"Enabled"=dword:00000000
"DisablePostLogonProvisioning"=dword:00000000

  • Change back to “Not Configured” (Remove “PassportForWork” Key)
Windows Registry Editor Version 5.00
[-HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork]

2.3 Command Prompt (CMD), .bat, .cmd

Save following as “filename.bat” or “filename.cmd” file then double click or entry following commands directly in Command Prompt window (Admin) to make the changes

  • Enable “Windows Hello for Business” and “Start Windows Hello provisioning after sign-in”
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork" /v Enabled /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork" /v DisablePostLogonProvisioning /t REG_DWORD /d 0 /f

  • Enable “Windows Hello for Business” but “Do not start Windows Hello provisioning after sign-in”
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork" /v Enabled /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork" /v DisablePostLogonProvisioning /t REG_DWORD /d 1 /f 

  • Disable “Windows Hello for Business”
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork" /v Enabled /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork" /v DisablePostLogonProvisioning /t REG_DWORD /d 0 /f  

  • Change back to “Not Configured” (Remove “PassportForWork” Key)
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork" /v Enabled /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork" /v DisablePostLogonProvisioning /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\PassportForWork" /f

Windows “Another installation is already in progress error”

Error

“Another program is being installed. Please wait until that installation is complete, and then try installing this software again.”

“Another installation is already in progress. Complete that installation before proceeding with this install.”

“Cannot run when setup is in progress.”

“Another installation is in progress. You must complete that installation before continuing this one.”

etc…


If it is due to running “msiexec.exe” try following

1 Copy and save following to Killmsiexec.bat or Killmsiexec.cmd

@echo off
echo dannyda.com
tasklist /fi "imagename eq msiexec.exe" | find /i "msiexec.exe" > nul
if not errorlevel 1 (taskkill /f /im "msiexec.exe") else (
  echo program msiexec.exe is not running
)
pause

2 Right click and run Killmsiexec.bat or Killmsiexec.cmd with administrator privilege

3 Now try the to install or uninstall the program again

How to resolve: Windows – “Destination Path Too Long” Error

Keywords: Microsoft Windows, Destination path too long, long file name, long path, Error, cmd, command prompt, run

When we are trying to rename, delete a folder or file which has very long length “Folder names + file name” or “Folder names” we will encounter following error

“The file name(s) would be too long for the destination folder. You can shorten the file name and try again, or try a location that has a shorter path.”

Microsoft Windows - Destinatoin Path Too Long
Microsoft Windows – Destinatoin Path Too Long

Try following methods

To Delete

1.1 Use Win + R launch “Run” window

Microsoft Windows - Run window
Microsoft Windows – Run window

1.2 Enter “cmd” in “Run” window, press Enter key to launch “Command Prompt” window

1.3 We use following command to delete the folder, including subfolders

rd /s /q "D:\FolderName"

e.g.

rd /s /q "D:\New Folder"

(The root folder “D:\New Folder” will be deleted too)

To Rename

2.1 Follow 1.1 to 1.2 to launch ” Command Prompt” window

2.2 Use following command to rename folder and file with long name which we can’t using windows file explorer

ren "D:\Folder Name" "D:\folder"

e.g.

ren "D:\my folder with very long name" "D:\newname"

ren "D:\folder\file with long name.txt" "D:\folder\file.txt"

e.g.

ren "D:\picture\my text file.txt" "D:\picture\my file.txt" 

How to change Windows proxy settings using cmd/command prompt/registry/.cmd/.bat

Keywords: Microsoft Windows proxy, proxy settings, Registry, regedit, Registry Editor, wildcard

Method 1: Using Registry directly

Warning: Changing other parameters from registry might cause damage to operating system, please modify carefully.

1 Use Win + R key combination open “Run” window

Microsoft Windows - Run window
Microsoft Windows – Run window

2 Enter “regedit” then press “OK” button

3 Find following path

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
Microsoft Windows - Registry Editor
Microsoft Windows – Registry Editor

4 Change/Create “DWORD” Key “ProxyEnable”, Set value to “0” to disable proxy, “1” to enable proxy

Registry Editor - ProxyEnable
Registry Editor – ProxyEnable

If you have enabled proxy from Step 4, follow below steps to continue configuration process

5 Change/Create “String Value” Key “ProxyServer”, Set value to <proxy address>:<port>. e.g.

127.0.0.1:1234 OR myproxyname.com:5678
Registry Editor - ProxyServer
Registry Editor – ProxyServer

Extra: If you need to exclude some addresses from proxy follow Step 6

6 Change/Create “String Value” Key “ProxyOverride”, Set value to include desired addresses which you want to exclude

10.0.0.1;google.com;localhost;*.bing.com;<local>;192.168.100.*
Registry Editor - ProxyOverride
Registry Editor – ProxyOverride

*.bing.com: Any domain under bing.com e.g. ads.bing.com, cdn.bing.com

192.168.100.*: Including the whole subnet (192.168.100.1-192.168.100.254)

<local>: Check the “Don’t use the proxy server for local (intranet) addresses” from Windows Settings

Windows Settings - Proxy
Windows Settings – Proxy

Method 2: Using command prompt

1 Use Win + R key combination open “Run” window

  • Enter following command and hit Enter key to disable proxy
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
  • Enable proxy
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
  • Set proxy IP address and port
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d 10.0.1.1:1234 /f
  • Bypass for selected addresses
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "10.0.0.1;google.com;localhost;*.bing.com;192.168.100.*;<local>" /f
  • Clean proxy settings
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /f

Method 3: Import proxy settings by using Registry file

1 Save desired proxy settings to a text file then change file extension from “.txt” to “.reg”

e.g. Save following text to “proxy.reg”

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"=dword:00000001
"ProxyServer"="10.0.1.0:1234"
"ProxyOverride"="10.0.0.1;google.com;localhost;*.bing.com;192.168.100.*"

2 Double click on “proxy.reg”

proxy.reg
proxy.reg

3 Click on “Yes” if you see this Window

User Account Control (UAC) Window - Registry Editor
User Account Control (UAC) Window – Registry Editor

4 Click on “Yes” to continue

Registry Editor - "Adding information can unintentionally change of delete values and cause components to stop working correctly. If you do not trust the source of this information in .... .reg, do not add it to the registry." "Are you sure you want to continue?"
Registry Editor – “Adding information can unintentionally change of delete values and cause components to stop working correctly. If you do not trust the source of this information in …. .reg, do not add it to the registry.” “Are you sure you want to continue?”

5 Now the proxy settings is imported, click on “OK”.

Registry Editor - "The keys and values contained in .. .reg have been successfully added to the registry."
Registry Editor – “The keys and values contained in .. .reg have been successfully added to the registry.”

Method 4: Using “.cmd” “.bat” file

1 Create a text file

2 Add following content to the text file

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d 10.0.1.0:1234 /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "10.0.0.1;google.com;localhost;*.bing.com;192.168.100.*" /f

3 Rename it to “enable-proxy.cmd” or “enable-proxy.bat”

4 Double click on enable-proxy.cmd” or “enable-proxy.bat”, now the proxy is configured (If not, run with administrator account)

To Disable proxy

1 Add following content to “disable-proxy.cmd” or “disable-proxy.bat”

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f

2 Double click on “disable-proxy.cmd” or “disable-proxy.bat” to run the commands

To Clean proxy settings (Doesn’t matter enabled or disabled)

1 Add following content to “clean-proxy.cmd” or “clean-proxy.bat”

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /f

2 Double click on “clean-proxy.cmd” or “clean-proxy.bat” to run the commands

Note: Using unknown proxy servers can be danger, especially when browsing websites or using apps which requires to login.

How to use CMD to find passwords for previously connected WiFi

1 Press Win + R to bring up Run window

Win + R, Run window
Win + R, Run window

2 Enter cmd and Press enter key

3 Enter “netsh wlan show profile” command and press enter key to show previously connected WiFi networks

CMD window, command line window
CMD window, command line window

4 Enter following command to show password of selected WiFi profile

netsh wlan show profile name="profilename" key=clear
Results of  netsh wlan show profile name="profilename" key=clear
Results of netsh wlan show profile name=”profilename” key=clear

Your WiFi password will be displayed under “Security settings” section with Key Content row.