SysAdmin Commands, Tips, and Tricks

Thought I haven't been in the System Administration space for too long, I've learned a number of tips, tricks, and shortcuts that I use almost on the daily. I've compiled a list of my most common.

Remotely Enable RDP

So you just set up a new desktop/server, you get back to your desk, but now you can't RDP to it? If you don't have Group Policy settings automatically configured to do this for you, or if those settings haven't yet been applied, you can easily do this via the registry. First, type regedit from a Run prompt. Then, select "File" and "Connect Network Registry". Type in the remote system's name, and then navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server. Change the value of fDenyTSConnections to 0. Select "OK", and you should now be able to RDP to that machine via the Remote Desktop Client.

Find Logon Server

Ever been curious which Domain Controller a specific device authenticated against? Easy. Open a Command Prompt and type echo %logonserver%. You'll return a server name.

Shutdown/Reboot Remote System

shutdown -r -m \\computername -f -t 60 where "60" is the number of seconds until the system reboots. The -f flag forces open programs to close immediately.

Alternatively, you can just shut down the machine by replacing the -r flag with -s.

If you've previously set a computer to reboot or shutdown with a -t flag, you can abort that by running shutdown -a before the timer expires.

I use these commands almost daily, most often when I don't want to be patient. I'll RDP to a system, begin an install, run a shutdown -r -t 1500, and then go to lunch. The program will finish installing, the computer will reboot, and it'll be back up and ready for me when I get back.

Continuous Ping

Linux does this by default when typing ping hostname. Windows, however, will only give you four results, as seen below.

However, by adding a -t flag, you'll get a continuous ping until you either close the command prompt, or cancel it by pressing Ctrl + C.

I find this most often being used when I'm waiting for a system to come back up after a reboot. I'll restart the computer, begin the ping, and once I get a response, I know I'm safe to RDP back into it again.

Quickly Find MAC Address

Rather than going through network dialog windows or scrolling through forever long lists via ipconfig, simply open up a command prompt and type getmac. It's quick, and easy, especially if you have multiple NIC interfaces.

Open CMD to your current location

I recently stumbled upon this trick a number of months back, and kick myself for not knowing it sooner, as it's saved me tons of time. Have you ever been working through Windows Explorer, and then need to open a CMD/Powershell window at that exact same location?

Previously, I would just open up the prompt and cd until I got to the directory I needed. Such a waste of time.

Now, simply go up to the address bar and either type cmd or powershell. Your respective terminal window will open up to the exact same location as Windows Explorer.

Miscellaneous Windows Shortcuts

Alt + D - Use this to quickly highlight the current link in the address bar for either Windows Explorer or most browsers (I prefer Chrome). It's surprising how much time you waste moving your mouse up to click on URLs all the time to either enter a new one, or copy the existing.

Windows + Pause/Break - This one opens Systems Properties, which gives you quick access to computer name, system memory, activation status and more.

Ctrl + Shift + Esc - Opens the Task Manager


That's all I've got for you. What tips and tricks do you find most useful?