Windows

From BarikWiki
Jump to: navigation, search

Bad Pool Header

Why do computers make it impossible to actually accomplish any work?

  • I can't seem to ever resume from Hibernate without an error occurring. This is a BSOD with BAD_POOL_HEADER.
  • You can view minidump files using NirSoft BlueScreenView, which can be found under C:\Windows\Minidump.

Windows XP

Remote

  • Sysinternals PsExec seems like another good way to accomplish this. You should really grab the whole Sysinternals Suite.
  • With psexec, I get the following error when connecting to a Windows XP machine: Make sure that the default admin$ share is enabled on titus-73afd7bb4. In this case, use the IP address instead of the machine name.
  • Example usage: psexec \\192.168.1.1 -u Administrator cmd.exe.
  • If you are sure you're using the right login and password and still get the error Login failure: unknown user name or bad password., then make sure you turn off Simple File Sharing in Windows XP, found under Tools / Folder Options / View / Use simple file sharing (Recommended).
  • You can use freeSSHd if you need an SSH server for Windows. It hasn't been updated in a while though.
  • TightVNC has a portable edition.

Grep

  • GnuWin32 provides ports of common UNIX tools like grep.

How do I do the equivalent of "grep"? You can use findstr. For example, to search every file in the current folder and all subfolders for the word "Smith":

FINDSTR /s /i smith *.*

Awesomely, this command can actually cause the command prompt to crash depending on the output returned.

Robocopy

Common operations with Robust File Copy:

  • /Z, copy files in restartable mode
  • /FFT, assume FAT File Times (2-second granularity)
  • /ETA, show estimated time of arrival on files.
  • /DCOPY:T, copy directory timestamps.

Sample:

robocopy /Z /FFT src dest
robocopy /MIR /DCOPY:T /ETA src dest

If you copy a root directory, it may be hidden. This attribute will get copied to the destination (use GetItem C:\ from within PowerShell to verify). You can use attrib -h -s to correct this.

Using the SC Tool

sc query | find "SERVICE_NAME"
sc create NewService binpath= c:\nt\system32\NewServ.exe type= own 
 start= auto depend= "+TDI Netbios"

Hosts File

A simple thing that is now made impossible is to edit the hosts file. This file is located in c:\windows\system32\drivers\etc\hosts. You're supposed to be able to use HostsToggle, but of course this doesn't work. Fiddling with UAC (or running as Administrator) appears to correct the issue.

Icons Go Missing

This restores icons by deleting the icon cache. The /IM flag specifies the image name.

taskkill /IM explorer.exe /F
CD /D %userprofile%\AppData\Local
DEL IconCache.db /A
shutdown /R

PuTTY

Motivated by wanting to access remote boxes without using a password. I used to use SSH keys quite often, until my main machine became a Windows box.

  • Use puttygen to easily generate public and private keys on Windows.
  • Copy the public key to .ssh/authorized_keys on the Linux end.
  • Failure to connect using the key is usually a permissions problem. On CentOS, /etc/ssh/sshd_config makes it appear that most configuration options are commented out, but a commented out value simply means that it is the default value.
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa 
  • How can you export a session in PuTTY?
  • As a security measure, you'll often get disconnected for idling in PuTTY. Under Connection, change "Seconds between keepalives (0 to to turn off)" to something like 60.

DOS and Other Legacy

Legacy DOS Batch Scripting

  • If you want to run a program, but end the script use start /B.
  • If you need the current directory, use %cd%.
  • How does for work? It is impressively complicated looking.

Better Command Prompt

  • Unlike Linux, the command line is pretty terrible in Windows. Try Console2 for an order of magnitude improvement.

Windows 8