Windows General

From Indie IT Wiki
Revision as of 13:03, 9 November 2024 by Gcoles (talk | contribs) (→‎Winget)

NOTE: For ease of life when opening either the command prompt, Powershell or Regedit run them as an administrator.

HOWTO: FIX:

Reset Network Adapters via commandline

Open either the command prompt or powershell as administrator, then run the following commands:

netsh winsock reset
netsh int ip reset
netsh int ipv6 reset
netsh advfirewall reset
ipconfig /flushdns
ipconfig /release
ipconfig /renew

Ignore messages about problems with Bluetooth adapters, then reboot the system.

For testing:

ipconfig /release
ipconfig /renew
arp -d *
nbtstat -R
nbtstat -RR
ipconfig /flushdns
ipconfig /registerdns

Exception Breakpoint Has Been Reached

This is an error that is often experienced when shutting down a system. In the case that brought it to our attention was a problem with OneDrive.

Windows Running Slowly

As with most things tech, this fix is not the be all and end all to fix a slow running system, but it is a place to start.

Open a command prompt:

sfc /scannow
Dism /Online /Cleanup-Image /ScanHealth
Dism /Online /Cleanup-Image /CheckHealth

If DISM reports a fault run the following:

Dism /Online /Cleanup-Image /RestoreHealth

To check for any errors, the log file is located at:

C:\Windows\Logs\CBS\CBS.log

When SFC has completed, run the following:

findstr /c:"[SR]" %windir%\logs\cbs\cbs.log >sfcdetails.txt 

The text file is outputted to the root of the user's directory.

For further information on deciphering the output, see the Microsoft Knowledge Base article found here.

Error: "Windows Update Cannot Check For Updates"

See the entry Windows Running Slowly

Unable To Install Or Remove Programmes

https://support.microsoft.com/en-us/help/17588/fix-problems-that-block-programs-from-being-installed-or-removed

Batch File to Release TCP/IP, Flush DNS, Reset Winsock, Reset Proxy

Copy and paste the following in to Notepad and save as a batch file:

ipconfig /release
ipconfig /renew
arp -d *
nbtstat -R
nbtstat -RR
ipconfig /flushdns
ipconfig /registerdns

Once you have the batch file run it in a command prompt.

Thanks to The Windows Club.

Windows Apps (Windows 10 & 11)

Open the PowerShell, then run the following:

Method One

Get-Appxpackage –Allusers
Get-AppXPackage -allusers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

Method Two

Get-AppxPackage -allusers | foreach {Add-AppxPackage -register "$($_.InstallLocation)\appxmanifest.xml" -DisableDevelopmentMode}

After running the above a system reboot is required.

HOWTO: LOCATE:

Licence Codes

http://www.howtogeek.com/206329/how-to-find-your-lost-windows-or-office-product-keys/

https://discuss.howtogeek.com/t/see-system-product-key-fast/12931

HOWTO: SHELL MENU:

Add "Take Ownership" to Explorer Right-Click Menu in Win 7, 8 or Vista

http://www.howtogeek.com/howto/windows-vista/add-take-ownership-to-explorer-right-click-menu-in-vista/

Generate File Listing On Shell Menu

Note: The following creates when you right click on a folder an entry in the shell menu called 'Create File Listing'. This creates a text document listing of all the files with in a folder, with the resulting text file saved in the folder itself. The listing is a plain list of all the files, if you want to have listed in the document details of the files themselves i.e. dates, then drop the /b switch.

Open Notepad and paste in the following text:

dir /a /b /-p /o:gen >filelisting.txt

Save the file in to the Windows directory calling it file_listing with a .bat file extension not .txt

Open Windows Explorer, click 'Tools' --> 'Folder Options' click on the 'Files Type' tab, find and highlight 'Folder' then click the 'Advanced' button.

Click the 'New' button, in the 'Action' box paste the following:

Create File Listing

Then browse to and highlight the .bat file created above.

Click all the 'OK' buttons as required.

HOWTO: REMOVE:

Devices & Device Drivers

Printer Server(s)

The Device Manager can be used to remove Print Servers.

Temporary Files With A Batch File

https://youprogrammer.com/how-to-delete-temporary-files-windows-10-8-7/

Old Shellbag Entries In Windows For Privacy

http://www.ghacks.net/2014/06/09/remove-old-shellbag-entries-windows-privacy/

Windows Service

  • Run services.msc
  • Locate the service you want to delete
  • Ensure it is not running
  • Right-click on the service entry and select 'Properties', on the corresponding windows that opens the actual name of the service as it appears in the registry will be highlighted in blue
  • Right-click on the highlighted name and select 'Copy'
  • Run Regedit or Regedt32.
  • Go to the registry entry "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services"
  • Look for the service that you want to delete and delete it, or run a search ensuring that the entry is in the location details above
  • Backup the entry and then delete it

HOWTO: COMMAND LINE:

NOTE: In all of the following open the terminal as an Administrator.

Active Ports Check

The following will output a full list of all ports and their state. On the system you wish to check:

netstat -a -n

Winsock - Reset

netsh winsock reset

Or

netsh winsock reset c:\winsocklog.txt # Generates log file

Restart system

Resync Clock

  • net stop w32time
  • w32tm /unregister
  • w32tm /register
  • net start w32time
  • w32tm /resync

Linux Equivalent Commands

https://www.lemoda.net/windows/windows2unix/windows2unix.html

DNS cache - Clearing/Flushing (Windows 7/8/10/11)

Even with a web browser's private mode enabled Windows still (inadvertently as this system was in place long before private mode browsing) tracks the websites visited by the machine via the DNS cache.

Output the contents of the DNS cache to a text file (the complete cache may well be too large to display in the terminal):

ipconfig /displaydns > dns.txt

Sample output:

Windows IP Configuration

   mozilla.org
   ----------------------------------------
   Record Name . . . . . : mozilla.org
   Record Type . . . . . : 1
   Time To Live  . . . . : 2
   Data Length . . . . . : 4
   Section . . . . . . . : Answer
   A (Host) Record . . . : 63.245.215.20

   mozilla.org
   ----------------------------------------
   No records of type AAAA

To clear the DNS cache:

ipconfig /flushdns

Thanks to Ghacks.

Delete Files and Folders

http://www.sevenforums.com/tutorials/55728-file-delete-command-prompt.html

Terminate Programmes

http://www.ghacks.net/2015/03/08/terminate-multiple-programs-from-the-command-line-with-taskkill/

Print a List of Installed Programmes

https://helpdeskgeek.com/how-to/generate-a-list-of-installed-programs-in-windows/

MAC Address

Command Prompt:

getmac

Shutdown, Restart etc

shutdown -r restarts
shutdown -s shutdown
shutdown -l logoff
shutdown -t xx number of seconds to wait till shutdown/restart/logoff
shutdown -i invokes the dialogue box to fill in what function you want to use
shutdown -a aborts a shutdown command
shutdown -t 0 -r -f forces a reboot when logged in remotely

System File Checker (SFC) Syntax

/scannow Scans all protected system files immediately
/verifyonly Scans all protected system files immediately, but without repairing
/scanonce Scans all protected system files once
/scanboot Scans all protected system files every time the computer is restarted
/revert Returns the scan to its default operation
/purgecache Purges the Windows File Protection file cache and scans all protected system files immediately.
/cachesize=x Sets the size, in MB, of the Windows File Protection file cache
/? Displays help at the command prompt

If SFC detects a corrupted file it will pull a copy from C:\Windows\WinSxS\Backup\, or if the directory is unavailable or itself corrupted the file will be drawn down from the internet.

Thanks to Microsoft

systeminfo Command

systeminfo is designed to display detailed configuration information about local or remote computers, providing details on operating system, operating system configuration, security information, product ID, as well as hardware properties, such as RAM, disk space, and network cards.

systeminfo /s A_Computer
systeminfo /s A_Computer | find "System Boot Time:"

Uninstall Windows Updates

wusa /uninstall /kb:xxxxxxx /quiet

Extend A Data Volume Disk Partition

http://support.microsoft.com/kb/325590

Winget

winget list

NOTE: This will display all the packages that Winget can manage along with their ID reference.

winget upgrade --all

winget export -o X:\list.json # Where 'X' is the drive letter of the drive being saved to.

winget import -i X:\list.json # Where 'X' is the drive letter of the drive being imported from.

OPTIONS: --accept-package-agreements --accept-source-agreements

NOTE: The .json file is saved in plain text so can be edited to suit the system needs.

winget search <query> # EG: obs

winget uninstall <query> # EG: 69420

NOTE: Uninstallation is done using the packages ID reference not its name.

NOTE: While the option to uninstall via Winget is available it is safer to use Windows Add/Remove Programs GUI as using the command line may result in dependencies for other installed packages being removed!

WinSxS Folder - Clean Up

Powershell: Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

Thanks to Mike Galvin

HOWTO: ALTER:

Background Intelligent Transfer Service (BITS) - Limiting Bandwidth

After much tarting around we found that the simplest solution to this issue is to purchase a modem/router that can instigate limiting the bandwidth on a system-by-system basis. Windows 11 does provide the ability to limit the speed of Updates, which can cause local area network slowdown.

Windows Password

https://www.howtogeek.com/howto/windows-vista/change-your-forgotten-windows-password-with-the-linux-system-rescue-cd/

DLL File Registration

The tool to register DLL files is located in the following places:

  • The 64-bit version is %systemroot%\System32\regsvr32.exe
  • The 32-bit version is %systemroot%\SysWoW64\regsvr32.exe

NOTE: 64bit Windows operating system have both versions of the Regsv32.exe file.

Syntax:

REGSVR32 [/U] [/S] [/C] [/I:[Command_Line]] DLL_Name
REGSVR32 [/U] [/S] [/C] /N /I:[Command_Line] DLL_Name

Switches:

/u  Unregister Server.
/s  Silent - no dialogue boxes.
/c  Console output.
/n  Don't call DllRegisterServer
/i  Call DllInstall (or DllUninstall if /u is specified)

Command_Line An optional command line for DllInstall

Examples:

Unregister (disable) XP Zip folders

REGSVR32 /u C:\Windows\System32\zipfldr.dll

Unregister (Disable) CAB file viewer:

REGSVR32 /u C:\Windows\System32\cabview.dll

Register (enable) XP Zip folders

REGSVR32 zipfldr.dll

Register (enable) CAB file viewer:

REGSVR32 cabview.dll

Thanks to Microsoft Support.

OEM Information

  • Open Regedit
  • Navigate the the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation
  • OEM systems, say those from manufacturers such as HP will display the following entries:
Logo
Manufacturer
Model
SupportHours
SupportPhone
SupportURL
  • Systems that created from a clean install will not display any values, and will need to be added.
  • To do so highlight the OEM key, then right click, select New > String Value and add one of the entries above.
  • Rinse and repeat for those you wish to add
  • Next double click on the value and in the resulting window add details in the Value data: box
  • Click OK
  • Rinse and repeat as required

NOTE: The OEM logo should be in .bmp format and no larger the 150x150 pixels, the file path will be needed in the value data.

Once all the information is entered correctly the entire key could be exported for use on other systems.

SendTo Menu

Start > Run > type sendto, and add items in the right window pane.

Windows’ Internet Connection Test

To improve privacy the built-in test can be modified or disabled:

http://www.ghacks.net/2014/02/07/disable-customize-windows-internet-connection-test-improve-privacy/

HOWTO: OFFLINE FILES

Clear Offline Files

If you have decided not to retain offline files and wish to clear any already stored undertake the following:

With offline files enabled change the percentage required for retention, in this case zero.

  • Press CTRL+SHIFT on your keyboard and then click the 'Delete Files...' button.
  • Once cleared un-tick the 'Enable Offline Files' check box.
  • Click 'Apply' then 'OK'.

Location

Applies to: XP, 7, Vista and 8(?)

C:\Windows\CSC

Synchronization: Ensuring It Is Disabled

Windows Explorer

Tools --> Folder Options --> Offline Files (Tab), ensure all options are un-ticked.

INFO: KEYBOARD SHORTCUTS:

Moving & Resizing open Windows or Applications

Aero Desktop Peek Win + Spacebar
Dock active Window to left/right Win + Left/Right arrow
Minimize all open Windows or Applications Win + M
Maximize vertical size of active Window Win + Shift + Up arrow
Maximize/Minimize active Window Win + Up/Down arrow
Minimize/maximize all inactive windows Win + Home
Move active Window between Dual Monitors Win + Shift + Left or Right Arrow
Moving & resizing active window Win + Up/Down/Left/Right arrows
Restore vertical size of active Window Win + Shift + Down arrow
Toggle Desktop display Win + D
Undo all window minimization Win + Shift + M
Toggle Desktop display Win + D

Taskbar

Cycle through all open taskbar Windows Alt + Esc
3D view of all open windows Win + Tab (hold Win and tap Tab to cycle)
Cycle through grouped taskbar items Hold Ctrl + tap Left Click
Get to taskbar items Win + T or Win + Shift + T for reverse order
Open a new instance of a taskbar Application Shift + Left mouse click
Open a new instance of a taskbar Application as Administrator Ctrl + Shift + Click
Open Taskbar Programs (pinned or open) Win + 1/2/3 s and so on
Persistent 3D view Ctrl + Win + Tab
Show Restore/Minimize/Move menu Of open application/window (grouped or ungrouped) Shift + Right click on taskbar icon

General, System Functions and Search

Create a new folder (where applicable) Ctrl + Shift + N
Delete without moving to Recycle bin Shift + Del
Full screen Command Prompt Alt + Enter Up to XP
Lock the computer: Win + L
Open a Program as Administrator Ctrl + Shift + Left mouse click
Open Command Prompt path to folder Shift + Right Click on/within a folder
Open Magnifier Win + =
Open Mobility Center Win + X
Open Windows Task Manager Ctrl + Shift + Esc
Move focus to the System Tray Win + B
Search for a file or folder Win + F
Search for computers: Ctrl + Win + F (domain PCs only)
Show advanced 'Send to...' menu Shift + Right mouse click
Show desktop gadgets Win + G
Switching between Laptop or Projector display Win + P
System Properties Win + Pause/Break
Utility Manager Win + U

Run Commands

NOTE: Win + R to open the Run dialogue box.

clipbrd your clipboard viewer Up to XP
control Current user's control panel
control userpasswords User Accounts Administration
excel Microsoft Excel
infopath Microsoft InfoPath
msaccess Microsoft Access
msmsgs Windows Messenger
msnmsgr MSN Messenger
mspub Microsoft Publisher
notepad Notepad (text editor)
ois Microsoft Office Picture Manager versions 2003 through 2010
outlook Microsoft Outlook
powerpnt Microsoft PowerPoint
services.msc Services
shrpubw.exe Shared Folder Wizard
sysedit System Configuration Editor
winword Microsoft Word
wordpad Word pad (text editor)

Advanced Users Run Commands

NOTE: Win + R to open the Run dialogue box.

control userpasswords2 User Accounts Administration
cmd Command prompt
cmd /k ipconfig Command prompt with IP address info
compmgmt.msc Computer management
devmgmt.msc Device manager
dfrg.msc Disk defragmenter
diskmgmt.msc Disk management
eventvwr.msc Event viewer
fsmgmt.msc Shared folders
gpedit.msc Group policies
gpupdate /force Force a refresh of Group Policies (domain workstation)
lusrmgr.msc Local users and groups
netsh diag gui Network diagnostics Up to XP
perfmon.msc Performance monitor
regedit Registry Editor
rsop.msc Resultant set of policies
secpol.msc Local security settings
services.msc Services
sysedit System Configuration Editor

INFO: GENERAL:

Clean Boot System

http://support.microsoft.com/kb/929135

Location Of A User's Currently Displayed Wallpaper

%AppData%\\Roaming\Microsoft\Windows\Themes\CachedFiles

Package Installation: Winget

https://learn.microsoft.com/en-us/windows/package-manager/winget/

Meltdown & Spectre Checking Tool

InSpectre

To identify the model of your (Kabylake, Skylake etc) processor use CPU-Z

Windows Update Error Codes Listing

https://support.microsoft.com/en-us/help/938205/windows-update-error-code-list

Windows Update Problems - Possible Fixes

  • Run Disk Cleanup
  • Run the Windows Update Troubleshooter - available for Windows 7 & 8, built-in to Windows 10.

https://support.microsoft.com/en-us/help/4027322/windows-update-troubleshooter

https://support.microsoft.com/en-us/windows/windows-update-troubleshooter-19bc41ca-ad72-ae67-af3c-89ce169755dd

  • Reset Windows Update components

Open the command prompt as administrator, the run the following:

net stop wuauserv 
net stop cryptSvc 
net stop bits
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
ren C:\Windows\System32\catroot2 Catroot2.old
net start wuauserv 
net start cryptSvc 
net start bits 
netsh winsock reset

Finally reboot your PC