Showing posts with label command line. Show all posts
Showing posts with label command line. Show all posts

Enable remote desktop access, using command line

If you need to RDP into a windows box that you have commandline access to, this is for you.


  1. First, permit RDP through the firewall.

    netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
    
    
    
  2. Then, enable terminal services in the registry using the reg command:
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
    
    
    
  3. Done!



To disable Remote Desktop access is just as easy:


  1. First, deny RDP through the firewall.

    netsh advfirewall firewall set rule group="remote desktop" new enable=No
    
    
    
  2. Then, disable terminal services in the registry using the reg command:
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
    
    
    
  3. Done!


Please note, you may need to reboot the windows machine for the changes to take effect (though problably not), and this doesn't work on "home" editions of Windows.

Dump SAM files using batch script. No "pwdump" necessary.

It sometimes happens that we need to dump the nthashes of the computer that we're on, but no matter how hard we try, we can't get it to work. Maybe the programs we like to use are being blocked by an antivirus, or maybe we need to boot off a CD and the boot device priority is locked and the cmos passworded.

Whatever the problem, I have a very simple solution: Use Windows' own built-in reg tool.

That's right, you can dump the sam hashes straight from the command prompt! Here's how:

reg save HKLM\SAM %computername%.sam
reg save HKLM\SYSTEM %computername%.system

Easy. As. Pie.