Tag Archives: Registry

How to Reset the Color of the Command Prompt in Windows 10

Hi everyone!

Recently bumped into an issue regarding the classic command prompt (CMD).

 

Problem:

CMD colors are changed so that you are unable to see the text, and cannot change back (for whatever reason)

 

Solution:

Change the REG_DWORD DefaultColor to “7

HKEY_CURRENT_USER\Software\Microsoft\Command Processor
Set-ItemProperty -Path 'HKCU:\Software\Microsoft\Command Processor' -Name DefaultColor -Value "7"

 

Voila!

Procmon saves the day!

 

[PS] Get Microsoft Office 2016 Version

This time we’re retrieving Microsoft Office 2016 Version with Get-ItemProperty

This is the fastest way i know to retrieve this value. You could also use Get-WmiObject win32_product but it will probably not be as fast.


$Version = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration"
$Version.ClientVersionToReport

[PS] Force applications to start on primary monitor

Windows 10 is great isn’t? But in some cases a slight modification is needed. In my case, we needed to make sure that Outlook, Excel, Word, PowerPoint and Internet Explorer always started on the primary monitor.

This script was created to make sure that your Inbox or a super secret document, doesn’t open on a external monitor, such as a projector etc.

In this case i have found 9 registry values that control the position of these applications, and with this script i simply remove this keys, and by doing this the applications will now start on your primary monitor.

It would probably be a better idea to remove these registry keys by GPO, but i have created this script to give you a hint of what can be done.

If you find out our more registry values that control other common applications startup locations, feel free to comment them below to help others.

Verified to work on Windows 10 1709 (16299), Office 2016 and Internet Explorer 11.

 

# Outlook
Remove-ItemProperty -Name 'Frame' -Path 'HKCU:\Software\Microsoft\Office\16.0\Outlook\Office Explorer' -Confirm:$false
# Word
Remove-ItemProperty -Name 'AppWindowPos' -Path 'HKCU:\Software\Microsoft\Office\16.0\Word\Options' -Confirm:$false
# Excel
Remove-ItemProperty -Name 'Pos' -Path 'HKCU:\Software\Microsoft\Office\16.0\Excel\Options' -Confirm:$false
# PowerPoint
Remove-ItemProperty -Name 'Top' -Path 'HKCU:\Software\Microsoft\Office\16.0\PowerPoint\Options' -Confirm:$false
Remove-ItemProperty -Name 'Bottom' -Path 'HKCU:\Software\Microsoft\Office\16.0\PowerPoint\Options' -Confirm:$false
Remove-ItemProperty -Name 'Left' -Path 'HKCU:\Software\Microsoft\Office\16.0\PowerPoint\Options' -Confirm:$false
Remove-ItemProperty -Name 'Right' -Path 'HKCU:\Software\Microsoft\Office\16.0\PowerPoint\Options' -Confirm:$false
# Skype For Business
Remove-ItemProperty -Name 'WindowRect' -Path 'HKCU:\Software\Microsoft\Office\16.0\Lync' -Confirm:$false
# Internet Explorer
Remove-ItemProperty -Name 'Window_Placement' -Path 'HKCU:\Software\Microsoft\Internet Explorer\Main' -Confirm:$false

[PS] Retrieve default PDF-reader registry value

Until now, i only knew one way of retrieving the default app-association for a specific file extension (.pdf, .xlsx, .docx) and that is by using DISM and exporting an .xml file. But this can only be done with an elevated prompt (as far as i know).

This is where my problem started, if you elevate an cmd prompt, you will only export the standard app-associations for that particular user (admin user). I wanted to display the standard app-associations for the user on that specific computer.

Long story short, i found the registry value where you can see this, it’s probably not a good idea to change this value here, for that you will have to use DISM i think, correct me if i’m wrong. If you want to retrieve the standard app-association for another file extension, just change .pdf to whatever you want to retrieve.

Registry path:


HKEY_USERS\YOUR-SID-HERE\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice

And what i uses this for is just running it on remote computers through a PS-session with this script:

Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$sid = ([System.DirectoryServices.AccountManagement.UserPrincipal]::Current).SID.Value
$path = "Registry::HKEY_USERS\$sid\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice"
(Get-ItemProperty -Path $path -Name ProgId).ProgId