Windows

Take Ownership

Add the following registry hack to get a "Take Ownership" context menu item:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

Convert document to UTF8 using PowerShell

In Powershell:

	Get-Content 'file-name' | Out-File 'file-name' -Encoding UTF8

Install features using PowerShell

  1. Open a Windows PowerShell session with elevated user rights. To do this, click Start, click All Programs, click Accessories, click Windows PowerShell, right-click the Windows PowerShell shortcut, and then click Run as administrator.
  2. Load the Server Manager module into the Windows PowerShell session before working with Server Manager cmdlets. Type the following, and then press Enter:
    Import-Module Servermanager
    	
  3. If you do not know the command name of the role, role service, or feature that you want to install, type the following, and then press Enter to return a list of all command names in the Name column. The command name is required for the next step.
    Get-WindowsFeature
    	
  4. Type the following, in which name represents the command name of the role, role service, or feature that was obtained in the previous step, and then press Enter to install a role or feature. The -restart parameter restarts the computer automatically after installation is complete, if a restart of the computer is required by the role or feature.
    Add-WindowsFeature name -restart
    	
  5. You can install multiple roles, role services, and features by using commas to separate the command names, as shown in the following example.
    Add-WindowsFeature Application-Server,Hyper-V,WAS
    	

MSI

Install named feature from .msi

msiexec /i package.msi /l*v log.log ADDLOCAL=Minimal

Uninstall product by product code

In powershell:

get-wmiobject Win32_Product | Format-Table IdentifyingNumber, Name, LocalPackage

... then use the product-code-guid in the statement below ...

msiexec /x product-code-guid

Tray Icon Programs

  1. Create a Windows Forms Application
  2. Add a ContextMenuStrip
  3. Add some entries to the context menu strip, double click on them to get the handlers e.g. exit (double click) -> handler -> Close()
  4. Add a NotifyIcon, in the designer set contextMenuStrip to the one you just created, set an icon
  5. Set properties for the form in the designer:
    FormBorderStyle: none
    Opacity: 0
    ShowIcon: false
    ShowInTaskbar: false
    WindowState: Minimized
    	
  6. Add Visible = false at the end of Form1_Load, this will hide the icon when using ctrl+tab

Icon sizes

Tray Icon: 16x16, 20x20, 24x24

App Icon: 16x16, 24x24, 32x32, 48x48, 64x64, 96x96, 128x128, 192x192, 256x256

Allow RDP Connections on Windows 8.1+

  1. alt + X, select Run
  2. SystemPropertiesRemote.exe + enter
  3. Deselect Allow connections only from computers running Remote Desktop with Network Level Authentication (recommended)

Using shell: shortcuts

  1. Alt + x, select run
  2. Enter shell:sendto to open the Send To folder

Ubuntu filesystem location (WSL)

The Ubuntu system files are stored at:

C:\Users\USERNAME\AppData\Local\Lxss\rootfs

Your Ubuntu user account's home folder is stored at:

C:\Users\USERNAME\AppData\Local\Lxss\home\USERNAME

The root account's home folder is stored at:

C:\Users\USERNAME\AppData\Local\Lxss\root

Smooth fonts in Google Chrome

  1. Type chrome://flags in the address bar + enter
  2. Scroll down to (or search for) LCD text antialiasing
  3. Set to Enabled
  4. Relaunch Chrome

Export printer to RDP server host

The printer on the client needs to be marked as shared and in your RDP you need to enable printer sharing.

On client:

  1. Open RegEdit
  2. Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Drivers (assuming 64 bits systems here)
  3. Lookup the InfPath for the printer in Version-3 or Version-4.
  4. Copy all files (and .inf file) to a folder somewhere on your RDP server host, ex. c:\PrinterDrivers\MyPrinter.

On RDP server host:

  1. Run printui /s /t 2.
  2. Click Add → Have Disk, browse to c:\Printers\Myprinters (as step 4 above).
  3. Install drivers.

The next time you connect to the RDP server host you should be able to print to your local printer from the RDP server host.