Stupid REGEDIT Tricks

This is probably one of those ‘been around forever and I just never noticed it’ features in REGEDIT.

Disclaimer: Use Registry Editor at your own risk. If you use Registry Editor incorrectly, you can cause serious problems that may require you to reinstall your operating system. This information is provided on an “as is” basis and all risk is with you. Improper use of Regedit can also make you sterile.  NoGeekLeftBehind makes no warranties, express, implied or statutory, as to any matter whatsoever, and does not guarantee that problems that you cause by using Registry Editor incorrectly can be resolved.

In REGEDIT the location of the current registry key is displayed at the bottom of the status bar, like this:

REGEDIT Key Location

Professional IT folks know the job isn’t over until the documentation is done. When documenting work performed in a service ticket I usually include detailed information about any registry settings that were changed. This means typing all of that location text at the bottom of the screen.

Well, it would seem I’ve been doing it the hard way all of these years.

SOLUTION

Just right-click the registry key name (in the navigation pane on the left), then left-click the Copy Key Name option.

Copy Key Name

Now the complete REGEDIT location is saved to your clipboard.

Example:
HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Excel\Security\Trusted Locations

Note: You’ll still have to document the DWORD or string values manually, but at least the Copy Key Name function saves a ton of typing.

Alternately, you can left-click the key name, then click on Edit | Copy Key Name from the top drop-down menu.

BONUS INFO

Now, you’re probably saying to yourself, “Duh, I already knew that! What I really need is a cool way to copy and paste a key path to avoid drilling down.”

Well, check out this nifty Windows Registry navigation trick by using the REGEDIT feature called Favorites (to which you probably never paid any attention).

To create a new REGEDIT favorite:

  1. Click the Key Name in the navigation bar on the left
  2. Click Favorites on the top drop-down menu
  3. Click Add to Favorites
    Sample registry location
  4. Type the name of the Favorite
  5. Click OK
    Add to Favorites

You should now see a new favorite listed, like this:

Jump to a Favorite

No matter where you are in the registry, clicking the Favorite will jump you to that location in the registry.

Interestingly, those Favorites / shortcuts are kept inside the registry itself,
(we’ll call it Rebel Base) here…

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites

…in a REG_SZ string value like this:

image
Here comes the ‘tricky’ part.

If you want to jump to a location in the registry you can just create a new String in Rebel Base.

For the sake of completeness we’ll show 4 options for registry favorites and changes

  • Option 1 – Manually Create a Registry Favorite

  • Option 2 – Manually Create a New String

  • Option 3 – Create a Registry Favorite by using REG ADD

  • Option 4 – Create a Registry Favorite by using PowerShell

OPTION 1 – Manually Create a Registry Favorite (easy)

If you know you’ll come back to a particular Registry location often:

  1. Navigate to the Registry location you want to save
  2. Left-click the Key*
  3. Click Favorites
  4. Click Add to Favorites
  5. Name the Favorite
  6. Click OK

*The first Favorite I would recommend creating is for Rebel Base, located here:
HKEY_CURRENT_USER
Software
Microsoft
Windows
CurrentVersion
Applets
Regedit
Favorites

If you perform Option 2 you’ll want to have that Favorite already saved.

OPTION 2 – Manually Create a New String

  1. a) Navigate to Rebel Base (if you already created it), or

    b) In REGEDIT navigate to HKCU | Software | Microsoft | Windows | CurrentVersion | Applets | Regedit | Favorites
     

    Registry Location A

  2. Right-click a blank space in the details pane | New | String Value
    New String Value
  3. Type the name of the new shortcut | hit Enter
    String Value Name
  4. Double-click the new string | paste the full registry path into the Value Data field | click OK

    Example – the location to enable / disable hiding file extensions:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced

    Edit String

  5. You should now see your new Favorite in the drop-down menu.
    New Favorite

Once you create the Rebel Base shortcut, from that point on you can easily copy and paste a Registry path into a new Favorite and jump to it.

OPTION 3 – Create a Registry Favorite by using REG ADD

If you know the path and the registry value you want to change, you can use the REG ADD command from the command line.

Alternately, you can save the command into a text file and save it with the .REG file extension.

For more information on the REG ADD command, visit TechNet:
http://technet.microsoft.com/en-us/library/cc742162.aspx

To create a Registry Favorite by using REG ADD:

  1. Open an Administrative Command Prompt
  2. Type REG ADD (include a space after each step)
  3. <Key Name> Paste the location (Key Name) for Rebel Base
  4. <Value Name> Type /v followed by the name for the new Favorite
      example: /v ViaCommandPrompt
  5. <Type> Type /t followed by REG_SZ
      example /t REG_SZ
  6. <Data> Type /d followed by the path (Key Name) of the new favorite

    Example:
    REG ADD via command prompt

    If you performed the steps correctly you should refresh REGEDIT and see your new shortcut.
    New Registry Value added via Command Prompt

 

OPTION 4 – Create a Registry Favorite by using PowerShell

To add a new Favorite by using PowerShell, we use the New-ItemProperty cmdlet and specify the following parameters:

  • New-ItemProperty
  • -Path (the Key Name (location) for Rebel Base)
  • -Name (the name you want to give the favorite)
  • -PropertyType String
  • -Value (the Key Name (location) for the target shortcut)

Note: The following example uses the single back tick to make reading easier

Example:

New-ItemProperty

Note: You may notice that the -Path contains HKCU: instead of HKEY_Current_User. The HKCU: command is just a shortcut. 

However, DO NOT use the “HKCU:” shortcut in the -Value line.

Also, double-quotes are important if your -Value includes a space in the Key Name.

Here’s what the PowerShell looks like when it runs in ISE.

New-ItemProperty Successful

And if we refresh REGEDIT we’ll now see our new Favorite.

Registry Favorite via PowerShell

SUMMARY

Favorites are a quick way to jump around in the Windows Registry. There’s always more than one way to skin a cat, and today we looked at four ways to create a Registry Favorite.

I would recommend creating a PowerShell .PS1 file that sets up Rebel Base for you. Then you can add more shortcuts easily on the fly.

I hope this information helps!

VN:F [1.9.20_1166]
Rating: 10.0/10 (3 votes cast)

Stupid Windows Tricks – Graph Summary View

You ever see an option in Windows that you never click? No?

(Well, maybe it’s just me then…)

Anyway, today I stumbled across the “Graph Summary View” in Server 2012 R2 that I’ve never clicked on before.

image

This feature leaves you a little floating window with either CPU, Memory or Ethernet usage:

CPU

CPU usage - Graph Summary View

Memory

Memory - Graph Summary View

Ethernet

Ethernet - Graph Summary View

This is pretty helpful for tracking resource usage when you’re remoted into a server with low screen resolution.

Once you’re in summary view you can flip between different resources:

Changing views - Graph Summary View

To go back to ‘normal’ mode just right-click and unselect Graph Summary View.

RESOURCE MONITOR

You can also manually shrink Resource Monitor to keep an eye on the server:

image

I’ll be on the lookout for other stuff I’ve never clicked on. Winking smile

VN:F [1.9.20_1166]
Rating: 10.0/10 (1 vote cast)

Stupid PowerShell Tricks – Getting Your PC to Talk

WarGamesRemember the 80’s? (Too young?)

One of my 80’s favorites was the movie WarGames.

(Hint: You should really watch it on Netflix – it’s a classic.
Here’s the WarGames movie trailer for you kids.)

Anyway, for those of you who DO remember War Games, that speech synthesizer was pretty creepy back in the day.
But it was equally cool because speech was pretty rare in those days unless you had a Texas Instruments TI-99/4A (which I did – woot!)

It’s hard to believe that movie came out 30 years ago, and technology has changed a lot. Windows has had speech built in for quite some time, but did you know you can access the speech API with PowerShell?

Who cares, right? WRONG! It’s pretty fun! And it’s a good bit of code to use to prank your IT co-workers. (Think login script or batch file that runs as a scheduled task…)

Here is a video demo of Windows Server 2012 reading classic computer lines from the movie WarGames:

“Joshua” from WarGames (1983) as played by Windows Server 2012 & PowerShell

 

Not too shabby for a Windows Server, eh?

So, shall we play a game?

Below is the PowerShell code for you to play with and tweak.
Have fun annoying people!

WarGames.ps1

Copy-and-paste code for WarGames.ps1

<#
.SYNOPSIS
    This script employs the Speech API for speaking
    and quotes lines from the movie "WarGames" (1983)
.DESCRIPTION
    At the beginning load the Speech API, create a SpeechSynthesizer object.
    It uses this object’s Speak method to speak
.NOTES
    File Name : WarGames.ps1
    Code From : DimiG | http://www.youtube.com/watch?v=Fg6icbeHWVY
    Requires  : PowerShell Version 2.0
.EXAMPLE
    Just for tutorial
#>

# Add text for speaking here
$text = @(`
"Hello, my name is Joshua.",`
"Greetings Professor Falken.",`
"Shall we play a game?",`
"Of course. I should reach DEF CON 1",`
"and launch my missiles in 28 hours.",`
"Would you like to see some projected kill ratios?",`
"What’s the difference?",`
"You are a hard man to reach.",`
"Could not find you in Seattle",`
"and no terminal is in operation at your classified address.",`
"D O D pension files indicate current mailing as:",`
"Dr Robert Hume,",`
"AKA Stephen W Falken,",`
"5 Tall Cedar Road.",`
"Strange game.",`
"The only winning move is not to play.",`
"How about a nice game of chess?"`
)

# Load the dll
[System.Reflection.Assembly]::LoadWithPartialName("System.Speech") | out-null

# Create new object
$spk = New-Object System.Speech.Synthesis.SpeechSynthesizer

# Step Up Volume
$spk.SetOutputToDefaultAudioDevice();
$spk.Volume = 100

# Check out voices installed on this computer…
$spk.GetInstalledVoices() | %{$_.voiceinfo}

# Now say…
$spk.Speak($text)

Props: DimiG for the PoSh code

VN:F [1.9.20_1166]
Rating: 7.7/10 (3 votes cast)