Tuesday, September 15, 2015

Disable F1 Windows Help and Support on Windows 8.1

One of the most useless things built into windows is the F1 help, unfortunately Microsoft doesn't make it easy to disable. I think I can say that I may have found the F1 help useful once, and that is probably pretty generous.

Below is a Powershell script which will disable the F1 help in windows. Basically, it takes control over helppane.exe and then renames it. Thankfully, if windows can't find the file, it will not through an error. If you want to restore the F1 help, just rename the executable back.
takeown /f c:\windows\helppane.exe
$acl = Get-Acl "C:\Windows\HelpPane.exe"
$rule = New-Object  System.Security.AccessControl.FileSystemAccessRule("$([Environment]::UserDomainName)\$([Environment]::UserName)","FullControl","Allow")
$acl.SetAccessRule($rule)
Set-Acl "C:\Windows\HelpPane.exe" $acl
Rename-Item "C:\Windows\HelpPane.exe" "C:\Windows\HelpPane1.exe"
This may work on other versions of windows, but I have only tested this on Windows 8.1.

Thursday, September 3, 2015

Powershell Open A Windows Explorer Window And Select A File

Just a quick useful function that I have used a couple times and always forget about. If you have a script that persists a file to disk, you can open a Windows Explorer window and select the file with this function. This can be useful in desktop applications as well. I'll leave it to the reader to translate it to C# (it leverages straight-up .Net functions already).
function Show-InExplorer($file) {
 $explorerArgs = "/select, $file";
 [System.Diagnostics.Process]::Start("explorer.exe", $explorerArgs) | Out-Null;
}
NOTE: Dispite what people have said on several StackOverflow posts, I found that I had to have the comma after the /select.