├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── Microsoft.PowerShell_profile.ps1 ├── NuGet_profile.ps1 ├── README.md ├── aliases.ps1 ├── bootstrap.ps1 ├── components-nuget.ps1 ├── components-shell.ps1 ├── components.ps1 ├── components ├── console.ps1 ├── coreaudio.ps1 ├── git.ps1 └── visualstudio.ps1 ├── deps.ps1 ├── exports.ps1 ├── functions.ps1 ├── home ├── .gemrc ├── .gitattributes ├── .gitconfig ├── .gitignore ├── .gvimrc.after ├── .hgignore ├── .hgrc ├── .npmrc └── .vimrc.after ├── profile.ps1 ├── setup └── install.ps1 └── windows.ps1 /.gitignore: -------------------------------------------------------------------------------- 1 | # The Extras file is secret. 2 | extra.ps1 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## v1.3.1 2 | Release 20-March-2015 3 | 4 | - Added EDITOR. Updated `Edit-Hosts` and `Edit-Profile` to use it if set. 5 | 6 | 7 | ## v1.3 8 | Released 20-March-2015 9 | 10 | - Separated Components into All, Shell, and Visual Studio specific instances. 11 | - Remove aliases on 'ls', 'wget', 'curl' if tools exist. 12 | - Set IE default page to `about:blank` for faster loading. 13 | - Added options to remove SysTray Power Icon, use small Taskbar icons, delete confirmation, bing search, store apps. 14 | - `vs` and `vsadmin` automatically open the CWD's Solution file if there is one. 15 | - Updated Hg configuration for better aliases, logging, color. 16 | 17 | 18 | ## v1.2 19 | Released 28-February-2014 20 | 21 | - Extracted GitHubForWindows and VisualStudio configurations to separate components 22 | - Fixed issue with VSIX Installer when the installer was not in `$env:PATH` 23 | - Fixed issue where `bootstrap.ps1` was not copying Component files. 24 | 25 | ## v1.1 26 | Released 18-February-2014 27 | 28 | #### Added core functionality: 29 | 30 | - Visual Studio environment variables, providing functionality very similar to `Visual Studio Command Prompt`. This functionality is only enabled if Visual Studio is installed, and will use the most recent version of VS. 31 | - Component / Submodule support, beginning with Audio 32 | 33 | #### New functions and aliases, including: 34 | 35 | - `emptytrash` and `Empty-RecycleBin` to clear all Recycle Bins for the user. 36 | - `fs` and `Get-DiskUsage` to show the disk use for a file or directory. 37 | - `lsd` to display only the directories under the current folder. 38 | - `mkd` to create a new directory and then cd into it. 39 | - `mute`, `unmute`, and `Set-SoundVolume` for system audio. 40 | - `reload` and `Reload-PowerShell` to reload PowerShell in a new window, loading all new settings and scripts. 41 | 42 | 43 | ## v1.0 44 | Released 17-February-2014 45 | 46 | Initial release 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2023 Jay Harris, www.jayharris.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Microsoft.PowerShell_profile.ps1: -------------------------------------------------------------------------------- 1 | # Profile for the Microsoft.Powershell Shell, only. (Not Visual Studio or other PoSh instances) 2 | # =========== 3 | 4 | Push-Location (Split-Path -parent $profile) 5 | "components-shell" | Where-Object {Test-Path "$_.ps1"} | ForEach-Object -process {Invoke-Expression ". .\$_.ps1"} 6 | Pop-Location 7 | -------------------------------------------------------------------------------- /NuGet_profile.ps1: -------------------------------------------------------------------------------- 1 | # Profile for the Visual Studio Shell, only. (e.g. Package Manager Console) 2 | # =========== 3 | 4 | Push-Location (Split-Path -parent $profile) 5 | "components-nuget" | Where-Object {Test-Path "$_.ps1"} | ForEach-Object -process {Invoke-Expression ". .\$_.ps1"} 6 | Pop-Location 7 | 8 | function Reinstall-Package { 9 | param( 10 | [Parameter(Mandatory = $true)] 11 | [string] 12 | $Id, 13 | 14 | [Parameter(Mandatory = $true)] 15 | [string] 16 | $Version, 17 | 18 | [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] 19 | [string] 20 | $ProjectName, 21 | 22 | [switch] 23 | $Force 24 | ) 25 | 26 | if (-not $ProjectName) { $ProjectName = (get-project).ProjectName } 27 | 28 | Uninstall-Package -ProjectName $ProjectName -Id $Id -Force:$Force 29 | Install-Package -ProjectName $ProjectName -Id $Id -Version $Version 30 | } 31 | 32 | # Wire StudioShell Functions if Exists 33 | if ((Get-Module -ListAvailable StudioShell) -ne $null) { 34 | Import-Module StudioShell 35 | 36 | <# 37 | function Reset-MultiMonitor { 38 | invoke-item DTE:\WindowConfigurations\MultiMonitor 39 | } 40 | function Reset-SingleMonitor { 41 | invoke-item DTE:\WindowConfigurations\SingleMonitor 42 | } 43 | 44 | $localMonitors = get-wmiobject -namespace root\WMI -computername localhost -Query "Select * from WmiMonitorID" 45 | if ($localMonitors.length -gt 1) { 46 | reset-multimonitor 47 | } else { 48 | reset-singlemonitor 49 | } 50 | Remove-Variable $localMonitors 51 | #> 52 | } 53 | 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Jay Harris's dotfiles for Windows 2 | 3 | A collection of PowerShell files for Windows, including common application installation through `Win-Get` and `npm`, and developer-minded Windows configuration defaults. 4 | 5 | Are you a Mac user? Check out my [dotfiles](https://github.com/jayharris/dotfiles) repository. 6 | 7 | ## Installation 8 | 9 | ### Using Git and the bootstrap script 10 | 11 | You can clone the repository wherever you want. (I like to keep it in `~\Projects\dotfiles-windows`.) The bootstrapper script will copy the files to your PowerShell Profile folder. 12 | 13 | From PowerShell: 14 | ```posh 15 | git clone https://github.com/jayharris/dotfiles-windows.git; cd dotfiles-windows; . .\bootstrap.ps1 16 | ``` 17 | 18 | To update your settings, `cd` into your local `dotfiles-windows` repository within PowerShell and then: 19 | 20 | ```posh 21 | . .\bootstrap.ps1 22 | ``` 23 | 24 | Note: You must have your execution policy set to unrestricted (or at least in bypass) for this to work: `Set-ExecutionPolicy Unrestricted`. 25 | 26 | ### Git-free install 27 | 28 | > **Note:** You must have your execution policy set to unrestricted (or at least in bypass) for this to work. To set this, run `Set-ExecutionPolicy Unrestricted` from a PowerShell running as Administrator. 29 | 30 | To install these dotfiles from PowerShell without Git: 31 | 32 | ```bash 33 | iex ((new-object net.webclient).DownloadString('https://raw.github.com/jayharris/dotfiles-windows/master/setup/install.ps1')) 34 | ``` 35 | 36 | To update later on, just run that command again. 37 | 38 | ## Use & Configuration 39 | 40 | ### PowerShell Profile 41 | 42 | The following commands are executed every time you launch a new 43 | PowerShell window. 44 | 45 | - `.\components.ps1` : Load various PowerShell components and modules. 46 | - `.\functions.ps1` : Configure custom PowerShell functions. 47 | - `.\aliases.ps1` : Configure alias-based commands. 48 | - `.\exports.ps1` : Configure environment variables. 49 | - `.\extra.ps1` : Secrets and secret commands that are not tracked by the Git repository. 50 | 51 | Also included are default configurations for Git, Mercurial, Ruby, NPM, and vim. 52 | 53 | ### Secrets 54 | 55 | You may have scripts or commands that you want to execute when loading PowerShell that you do not want committed into your own `dotfiles` repository, such as a place to put tokens or credentials or even your Git commit email address. For such secret commands, use `.\extra.ps1`. 56 | 57 | If `.\extra.ps1` exists, it will be sourced along with the other files. 58 | 59 | My `.\extra.ps1` looks something like this: 60 | 61 | ```posh 62 | # Hg credentials 63 | # Not in the repository, to prevent people from accidentally committing under my name 64 | Set-Environment "EMAIL" "Jay Harris " 65 | 66 | # Git credentials 67 | # Not in the repository, to prevent people from accidentally committing under my name 68 | Set-Environment "GIT_AUTHOR_NAME" "Jay Harris","User" 69 | Set-Environment "GIT_COMMITTER_NAME" $env:GIT_AUTHOR_NAME 70 | git config --global user.name $env:GIT_AUTHOR_NAME 71 | Set-Environment "GIT_AUTHOR_EMAIL" "jay@aranasoft.com" 72 | Set-Environment "GIT_COMMITTER_EMAIL" $env:GIT_AUTHOR_EMAIL 73 | git config --global user.email $env:GIT_AUTHOR_EMAIL 74 | ``` 75 | 76 | Extras is designed to augment the existing settings and configuration. You could also use `./extra.ps1` to override settings, functions and aliases from my dotfiles repository, but it is probably better to [fork this repository](#forking-your-own-version). 77 | 78 | ### Sensible Windows defaults 79 | 80 | When setting up a new Windows PC, you may want to set some Windows defaults and features, such as showing hidden files in Windows Explorer, configuring privacy settings, installing IIS, and uninstalling Candy Crush. You are encouraged to browse through the file to understand all of the modifications and to modify these settings based on your own preferences. 81 | 82 | ```posh 83 | .\windows.ps1 84 | ``` 85 | 86 | This script will also set your machine name, so you may want to modify this file before executing. 87 | ```posh 88 | (Get-WmiObject Win32_ComputerSystem).Rename("MyMachineName") | Out-Null 89 | ``` 90 | 91 | ### Dependencies: Tools, Utilities, and Packages 92 | 93 | Setting up a new Windows machine often requires installation of common packages, utilities, and dependencies. These could include node.js packages via [NPM](https://www.npmjs.org), Win-Get packages, Windows Features and Tools, and Visual Studio Extensions. 94 | 95 | ```posh 96 | .\deps.ps1 97 | ``` 98 | 99 | ## Customization 100 | 101 | ## Forking your own version 102 | 103 | These scripts are for my preferences; your preferences may be different. 104 | 105 | This repository is built around how I use Windows, which is predominantly in a VM hosted on macOS. As such, things like VNC, FileZilla, or Skype are not installed, as they are available to me on the macOS side, installed by my [OS X dotfiles](https://github.com/jayharris/dotfiles). If you are using Windows as your primary OS, you may want a different configuration that reflects that, and I recommend you [fork this repository](https://github.com/jayharris/dotfiles-windows/fork). 106 | 107 | If you do fork for your own custom configuration, you will need to touch a few files to reference your own repository, instead of mine. 108 | 109 | Within `/setup/install.ps1`, modify the Repository variables. 110 | ```posh 111 | $account = "jayharris" 112 | $repo = "dotfiles-windows" 113 | $branch = "master" 114 | ``` 115 | 116 | Finally, be sure to reference your own repository in the git-free installation command. 117 | ```bash 118 | iex ((new-object net.webclient).DownloadString('https://raw.github.com/$account/$repo/$branch/setup/install.ps1')) 119 | ``` 120 | 121 | ## Feedback 122 | 123 | Suggestions/improvements are 124 | [welcome and encouraged](https://github.com/jayharris/dotfiles-windows/issues)! 125 | 126 | ## Author 127 | 128 | | [![twitter/jayharris](http://gravatar.com/avatar/1318668b99b2d5a3900f3f7758763a69?s=70)](http://twitter.com/jayharris "Follow @jayharris on Twitter") | 129 | |---| 130 | | [Jay Harris](http://twitter.com/jayharris/) | 131 | 132 | ## Thanks to… 133 | 134 | * @[Mathias Bynens](http://mathiasbynens.be/) for his [OS X dotfiles](http://mths.be/dotfiles), which this repository is modeled after. 135 | -------------------------------------------------------------------------------- /aliases.ps1: -------------------------------------------------------------------------------- 1 | # Easier Navigation: .., ..., ...., ....., and ~ 2 | ${function:~} = { Set-Location ~ } 3 | # PoSh won't allow ${function:..} because of an invalid path error, so... 4 | ${function:Set-ParentLocation} = { Set-Location .. }; Set-Alias ".." Set-ParentLocation 5 | ${function:...} = { Set-Location ..\.. } 6 | ${function:....} = { Set-Location ..\..\.. } 7 | ${function:.....} = { Set-Location ..\..\..\.. } 8 | ${function:......} = { Set-Location ..\..\..\..\.. } 9 | 10 | # Navigation Shortcuts 11 | ${function:drop} = { Set-Location ~\Documents\Dropbox } 12 | ${function:dt} = { Set-Location ~\Desktop } 13 | ${function:docs} = { Set-Location ~\Documents } 14 | ${function:dl} = { Set-Location ~\Downloads } 15 | 16 | # Missing Bash aliases 17 | Set-Alias time Measure-Command 18 | 19 | # Correct PowerShell Aliases if tools are available (aliases win if set) 20 | # WGet: Use `wget.exe` if available 21 | if (Get-Command wget.exe -ErrorAction SilentlyContinue | Test-Path) { 22 | rm alias:wget -ErrorAction SilentlyContinue 23 | } 24 | 25 | # Directory Listing: Use `ls.exe` if available 26 | if (Get-Command ls.exe -ErrorAction SilentlyContinue | Test-Path) { 27 | rm alias:ls -ErrorAction SilentlyContinue 28 | # Set `ls` to call `ls.exe` and always use --color 29 | ${function:ls} = { ls.exe --color @args } 30 | # List all files in long format 31 | ${function:l} = { ls -lF @args } 32 | # List all files in long format, including hidden files 33 | ${function:la} = { ls -laF @args } 34 | # List only directories 35 | ${function:lsd} = { Get-ChildItem -Directory -Force @args } 36 | } else { 37 | # List all files, including hidden files 38 | ${function:la} = { ls -Force @args } 39 | # List only directories 40 | ${function:lsd} = { Get-ChildItem -Directory -Force @args } 41 | } 42 | 43 | # curl: Use `curl.exe` if available 44 | if (Get-Command curl.exe -ErrorAction SilentlyContinue | Test-Path) { 45 | rm alias:curl -ErrorAction SilentlyContinue 46 | # Set `ls` to call `ls.exe` and always use --color 47 | ${function:curl} = { curl.exe @args } 48 | # Gzip-enabled `curl` 49 | ${function:gurl} = { curl --compressed @args } 50 | } else { 51 | # Gzip-enabled `curl` 52 | ${function:gurl} = { curl -TransferEncoding GZip } 53 | } 54 | 55 | # Create a new directory and enter it 56 | Set-Alias mkd CreateAndSet-Directory 57 | 58 | # Determine size of a file or total size of a directory 59 | Set-Alias fs Get-DiskUsage 60 | 61 | # Empty the Recycle Bin on all drives 62 | Set-Alias emptytrash Empty-RecycleBin 63 | 64 | # Cleanup old files all drives 65 | Set-Alias cleandisks Clean-Disks 66 | 67 | # Reload the shell 68 | Set-Alias reload Reload-Powershell 69 | 70 | # http://xkcd.com/530/ 71 | Set-Alias mute Set-SoundMute 72 | Set-Alias unmute Set-SoundUnmute 73 | 74 | # Update installed Ruby Gems, NPM, and their installed packages. 75 | Set-Alias update System-Update 76 | 77 | # Set GVim as default vim 78 | Set-Alias vim gvim 79 | -------------------------------------------------------------------------------- /bootstrap.ps1: -------------------------------------------------------------------------------- 1 | $profileDir = Split-Path -parent $profile 2 | $componentDir = Join-Path $profileDir "components" 3 | 4 | New-Item $profileDir -ItemType Directory -Force -ErrorAction SilentlyContinue 5 | New-Item $componentDir -ItemType Directory -Force -ErrorAction SilentlyContinue 6 | 7 | Copy-Item -Path ./*.ps1 -Destination $profileDir -Exclude "bootstrap.ps1" 8 | Copy-Item -Path ./components/** -Destination $componentDir -Include ** 9 | Copy-Item -Path ./home/** -Destination $home -Include ** 10 | 11 | Remove-Variable componentDir 12 | Remove-Variable profileDir 13 | -------------------------------------------------------------------------------- /components-nuget.ps1: -------------------------------------------------------------------------------- 1 | # These components will be loaded within a Visual Studio shell (e.g. Package Manager Console) 2 | 3 | Push-Location (Join-Path (Split-Path -parent $profile) "components") 4 | 5 | # From within the ./components directory... 6 | 7 | Pop-Location 8 | -------------------------------------------------------------------------------- /components-shell.ps1: -------------------------------------------------------------------------------- 1 | # These components will be loaded when running Microsoft.Powershell (i.e. Not Visual Studio) 2 | 3 | Push-Location (Join-Path (Split-Path -parent $profile) "components") 4 | 5 | # From within the ./components directory... 6 | . .\visualstudio.ps1 7 | . .\console.ps1 8 | 9 | Pop-Location 10 | -------------------------------------------------------------------------------- /components.ps1: -------------------------------------------------------------------------------- 1 | # These components will be loaded for all PowerShell instances 2 | 3 | Push-Location (Join-Path (Split-Path -parent $profile) "components") 4 | 5 | # From within the ./components directory... 6 | . .\coreaudio.ps1 7 | . .\git.ps1 8 | 9 | Pop-Location 10 | -------------------------------------------------------------------------------- /components/console.ps1: -------------------------------------------------------------------------------- 1 | # Utilities to manage PowerShell Consoles 2 | # Based on code from ConCFG: https://github.com/lukesampson/concfg/ 3 | 4 | Add-Type -TypeDefinition @' 5 | using System; 6 | using System.Runtime.InteropServices; 7 | using System.Runtime.InteropServices.ComTypes; 8 | 9 | namespace dotfiles { 10 | public class ShortcutManager { 11 | public static void ResetConsoleProperties(string path) { 12 | if (!System.IO.File.Exists(path)) { return; } 13 | 14 | var file = new ShellLink() as IPersistFile; 15 | if (file == null) { return; } 16 | 17 | file.Load(path, 2 /* STGM_READWRITE */); 18 | var data = (IShellLinkDataList) file; 19 | 20 | data.RemoveDataBlock( 0xA0000002 /* NT_CONSOLE_PROPS_SIG */); 21 | file.Save(path, true); 22 | 23 | Marshal.ReleaseComObject(data); 24 | Marshal.ReleaseComObject(file); 25 | } 26 | } 27 | 28 | [ComImport, Guid("00021401-0000-0000-C000-000000000046")] 29 | class ShellLink { } 30 | 31 | [ComImport, Guid("45e2b4ae-b1c3-11d0-b92f-00a0c90312e1"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 32 | interface IShellLinkDataList { 33 | void AddDataBlock(IntPtr pDataBlock); 34 | void CopyDataBlock(uint dwSig, out IntPtr ppDataBlock); 35 | void RemoveDataBlock(uint dwSig); 36 | void GetFlags(out uint pdwFlags); 37 | void SetFlags(uint dwFlags); 38 | } 39 | } 40 | '@ 41 | 42 | function Verify-Elevated { 43 | # Get the ID and security principal of the current user account 44 | $myIdentity=[System.Security.Principal.WindowsIdentity]::GetCurrent() 45 | $myPrincipal=new-object System.Security.Principal.WindowsPrincipal($myIdentity) 46 | # Check to see if we are currently running "as Administrator" 47 | return $myPrincipal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator) 48 | } 49 | 50 | function Verify-PowershellShortcut { 51 | [CmdletBinding()] 52 | param ( 53 | [Parameter(Mandatory=$true, ValueFromPipeline=$true)] 54 | [string] $Path 55 | ) 56 | 57 | if (!(Test-Path $Path -PathType Leaf)) { return $false } 58 | if ([System.IO.Path]::GetExtension($Path) -ne ".lnk") { return $false; } 59 | 60 | $shell = New-Object -COMObject WScript.Shell -Strict 61 | $shortcut = $shell.CreateShortcut("$(Resolve-Path $Path)") 62 | 63 | $result = ($shortcut.TargetPath -eq "$env:WINDIR\system32\WindowsPowerShell\v1.0\powershell.exe") -or ` 64 | ($shortcut.TargetPath -eq "$env:WINDIR\syswow64\WindowsPowerShell\v1.0\powershell.exe") 65 | [Runtime.Interopservices.Marshal]::ReleaseComObject($shortcut) | Out-Null 66 | return $result 67 | } 68 | 69 | function Verify-BashShortcut { 70 | [CmdletBinding()] 71 | param ( 72 | [Parameter(Mandatory=$true, ValueFromPipeline=$true)] 73 | [string] $Path 74 | ) 75 | 76 | if (!(Test-Path $Path -PathType Leaf)) { return $false } 77 | if ([System.IO.Path]::GetExtension($Path) -ne ".lnk") { return $false; } 78 | 79 | $shell = New-Object -COMObject WScript.Shell -Strict 80 | $shortcut = $shell.CreateShortcut("$(Resolve-Path $Path)") 81 | 82 | $result = ($shortcut.TargetPath -eq "$env:WINDIR\system32\bash.exe") 83 | [Runtime.Interopservices.Marshal]::ReleaseComObject($shortcut) | Out-Null 84 | return $result 85 | } 86 | 87 | function Reset-PowerShellShortcut { 88 | [CmdletBinding()] 89 | param ( 90 | [Parameter(Mandatory=$true, ValueFromPipeline=$true)] 91 | [string] $Path 92 | ) 93 | 94 | if (!(Test-Path $Path)) { Return } 95 | 96 | if (Test-Path $Path -PathType Container) { 97 | Get-ChildItem $Path | ForEach { 98 | Reset-PowerShellShortcut $_.FullName 99 | } 100 | Return 101 | } 102 | 103 | if (Verify-PowershellShortcut $Path) { 104 | $filePath = Resolve-Path $Path 105 | 106 | try { 107 | [dotfiles.ShortcutManager]::ResetConsoleProperties($filePath) 108 | $shell = New-Object -COMObject WScript.Shell -Strict 109 | $shortcut = $shell.CreateShortcut("$(Resolve-Path $path)") 110 | $shortcut.Arguments = "-nologo" 111 | $shortcut.Save() 112 | [Runtime.Interopservices.Marshal]::ReleaseComObject($shortcut) | Out-Null 113 | [Runtime.Interopservices.Marshal]::ReleaseComObject($shell) | Out-Null 114 | } 115 | catch [UnauthorizedAccessException] { 116 | Write-Warning "warning: admin permission is required to remove console props from $path" 117 | } 118 | } 119 | } 120 | 121 | function Reset-BashShortcut { 122 | [CmdletBinding()] 123 | param ( 124 | [Parameter(Mandatory=$true, ValueFromPipeline=$true)] 125 | [string] $Path 126 | ) 127 | 128 | if (!(Test-Path $Path)) { Return } 129 | 130 | if (Test-Path $Path -PathType Container) { 131 | Get-ChildItem $Path | ForEach { 132 | Reset-BashShortcut $_.FullName 133 | } 134 | Return 135 | } 136 | 137 | if (Verify-BashShortcut $Path) { 138 | $filePath = Resolve-Path $Path 139 | 140 | try { 141 | [dotfiles.ShortcutManager]::ResetConsoleProperties($filePath) 142 | $shell = New-Object -COMObject WScript.Shell -Strict 143 | $shortcut = $shell.CreateShortcut("$(Resolve-Path $path)") 144 | $shortcut.Save() 145 | [Runtime.Interopservices.Marshal]::ReleaseComObject($shortcut) | Out-Null 146 | [Runtime.Interopservices.Marshal]::ReleaseComObject($shell) | Out-Null 147 | } 148 | catch [UnauthorizedAccessException] { 149 | Write-Warning "warning: admin permission is required to remove console props from $path" 150 | } 151 | } 152 | } 153 | 154 | function Reset-AllPowerShellShortcuts { 155 | @(` 156 | "$ENV:ALLUSERSPROFILE\Microsoft\Windows\Start Menu\Programs",` 157 | "$ENV:USERPROFILE\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu",` 158 | "$ENV:USERPROFILE\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar",` 159 | "$ENV:USERPROFILE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs"` 160 | ) | ForEach { Reset-PowerShellShortcut $_ } 161 | } 162 | 163 | function Reset-AllBashShortcuts { 164 | @(` 165 | "$ENV:ALLUSERSPROFILE\Microsoft\Windows\Start Menu\Programs",` 166 | "$ENV:USERPROFILE\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu",` 167 | "$ENV:USERPROFILE\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar",` 168 | "$ENV:USERPROFILE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs"` 169 | ) | ForEach { Reset-BashShortcut $_ } 170 | } 171 | 172 | function Convert-ConsoleColor { 173 | [CmdletBinding()] 174 | param ( 175 | [Parameter(Mandatory=$true, ValueFromPipeline=$true)] 176 | [string]$rgb 177 | ) 178 | 179 | if ($rgb -notmatch '^#[\da-f]{6}$') { 180 | write-Error "Invalid color '$rgb' should be in RGB hex format, e.g. #000000" 181 | Return 182 | } 183 | $num = [Convert]::ToInt32($rgb.substring(1,6), 16) 184 | $bytes = [BitConverter]::GetBytes($num) 185 | [Array]::Reverse($bytes, 0, 3) 186 | return [BitConverter]::ToInt32($bytes, 0) 187 | } 188 | 189 | -------------------------------------------------------------------------------- /components/coreaudio.ps1: -------------------------------------------------------------------------------- 1 | Add-Type -TypeDefinition @' 2 | using System.Runtime.InteropServices; 3 | 4 | [Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 5 | interface IAudioEndpointVolume { 6 | // f(), g(), ... are unused COM method slots. Define these if you care 7 | int f(); int g(); int h(); int i(); 8 | int SetMasterVolumeLevelScalar(float fLevel, System.Guid pguidEventContext); 9 | int j(); 10 | int GetMasterVolumeLevelScalar(out float pfLevel); 11 | int k(); int l(); int m(); int n(); 12 | int SetMute([MarshalAs(UnmanagedType.Bool)] bool bMute, System.Guid pguidEventContext); 13 | int GetMute(out bool pbMute); 14 | } 15 | [Guid("D666063F-1587-4E43-81F1-B948E807363F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 16 | interface IMMDevice { 17 | int Activate(ref System.Guid id, int clsCtx, int activationParams, out IAudioEndpointVolume aev); 18 | } 19 | [Guid("A95664D2-9614-4F35-A746-DE8DB63617E6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 20 | interface IMMDeviceEnumerator { 21 | int f(); // Unused 22 | int GetDefaultAudioEndpoint(int dataFlow, int role, out IMMDevice endpoint); 23 | } 24 | [ComImport, Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")] class MMDeviceEnumeratorComObject { } 25 | 26 | public class Audio { 27 | static IAudioEndpointVolume Vol() { 28 | var enumerator = new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator; 29 | IMMDevice dev = null; 30 | Marshal.ThrowExceptionForHR(enumerator.GetDefaultAudioEndpoint(/*eRender*/ 0, /*eMultimedia*/ 1, out dev)); 31 | IAudioEndpointVolume epv = null; 32 | var epvid = typeof(IAudioEndpointVolume).GUID; 33 | Marshal.ThrowExceptionForHR(dev.Activate(ref epvid, /*CLSCTX_ALL*/ 23, 0, out epv)); 34 | return epv; 35 | } 36 | public static float Volume { 37 | get {float v = -1; Marshal.ThrowExceptionForHR(Vol().GetMasterVolumeLevelScalar(out v)); return v;} 38 | set {Marshal.ThrowExceptionForHR(Vol().SetMasterVolumeLevelScalar(value, System.Guid.Empty));} 39 | } 40 | public static bool Mute { 41 | get { bool mute; Marshal.ThrowExceptionForHR(Vol().GetMute(out mute)); return mute; } 42 | set { Marshal.ThrowExceptionForHR(Vol().SetMute(value, System.Guid.Empty)); } 43 | } 44 | } 45 | '@ -------------------------------------------------------------------------------- /components/git.ps1: -------------------------------------------------------------------------------- 1 | if (((Get-Command git -ErrorAction SilentlyContinue) -ne $null) -and ((Get-Module -ListAvailable Posh-Git -ErrorAction SilentlyContinue) -ne $null)) { 2 | Import-Module Posh-Git 3 | } 4 | -------------------------------------------------------------------------------- /components/visualstudio.ps1: -------------------------------------------------------------------------------- 1 | # Configure Visual Studio 2 | if ((Test-Path "hklm:\SOFTWARE\Microsoft\VisualStudio\SxS\VS7") -or (Test-Path "hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7")) { 3 | # Add a folder to $env:Path 4 | function Append-EnvPath([String]$path) { $env:PATH = $env:PATH + ";$path" } 5 | function Append-EnvPathIfExists([String]$path) { if (Test-Path $path) { Append-EnvPath $path } } 6 | 7 | $vsRegistry = Get-Item "hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" -ErrorAction SilentlyContinue 8 | if ($vsRegistry -eq $null) { $vsRegistry = Get-Item "hklm:\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" } 9 | $vsVersion = $vsRegistry.property | Sort-Object {[int]$_} -Descending | Select-Object -first 1 10 | $vsinstall = ForEach-Object -process {$vsRegistry.GetValue($vsVersion)} 11 | Remove-Variable vsRegistry 12 | 13 | if ((Test-Path $vsinstall) -eq 0) {Write-Error "Unable to find Visual Studio installation"} 14 | 15 | $env:VisualStudioVersion = $vsVersion 16 | $env:Framework40Version = "v4.0" 17 | $env:VSINSTALLDIR = $vsinstall 18 | $env:DevEnvDir = Join-Path $vsinstall "Common7\IDE\" 19 | if (!($env:Path).Split(";").Contains($vsinstall)) { Append-EnvPath $vsinstall } 20 | $vsCommonToolsVersion = $vsVersion.replace(".","") 21 | Invoke-Expression "`$env:VS${vsCommonToolsVersion}COMN = Join-Path `"$vsinstall`" `"Common7\Tools`"" 22 | Invoke-Expression "`$env:VS${vsCommonToolsVersion}COMNTOOLS = Join-Path `"$vsinstall`" `"Common7\Tools`"" 23 | Remove-Variable vsCommonToolsVersion 24 | Remove-Variable vsinstall 25 | 26 | $env:GYP_MSVS_VERSION = @{ 27 | "9.0"="2008"; 28 | "10.0"="2010"; 29 | "11.0"="2012"; 30 | "12.0"="2013"; 31 | "14.0"="2015"; 32 | "15.0"="2017"; 33 | }.Get_Item($vsVersion) 34 | 35 | Append-EnvPathIfExists (Join-Path $env:VSINSTALLDIR "Common7\Tools") 36 | Append-EnvPathIfExists (Join-Path $env:VSINSTALLDIR "Team Tools\Performance Tools") 37 | Append-EnvPathIfExists (Join-Path $env:VSINSTALLDIR "VSTSDB\Deploy") 38 | Append-EnvPathIfExists (Join-Path $env:VSINSTALLDIR "CommonExtensions\Microsoft\TestWindow") 39 | Append-EnvPathIfExists (Join-Path $env:ProgramFiles "MSBuild\$vsVersion\bin") 40 | Append-EnvPathIfExists (Join-Path ${env:ProgramFiles(x86)} "MSBuild\$vsVersion\bin") 41 | Append-EnvPathIfExists (Join-Path $env:ProgramFiles "Microsoft SDKs\TypeScript") 42 | Append-EnvPathIfExists (Join-Path ${env:ProgramFiles(x86)} "Microsoft SDKs\TypeScript") 43 | Append-EnvPathIfExists (Join-Path $env:ProgramFiles "HTML Help Workshop") 44 | Append-EnvPathIfExists (Join-Path ${env:ProgramFiles(x86)} "HTML Help Workshop") 45 | 46 | Remove-Variable vsVersion 47 | 48 | if ((Test-Path "hklm:\SOFTWARE\Microsoft\VisualStudio\SxS\VC7") -or (Test-Path "hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7")) { 49 | $vcRegistry = Get-Item "hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7" -ErrorAction SilentlyContinue 50 | if ($vcRegistry -eq $null) { $vcRegistry = Get-Item "hklm:\SOFTWARE\Microsoft\VisualStudio\SxS\VC7" } 51 | $env:VCINSTALLDIR = $vcRegistry.GetValue($env:VisualStudioVersion) 52 | $env:FrameworkDir32 = $vcRegistry.GetValue("FrameworkDir32") 53 | $env:FrameworkDir64 = $vcRegistry.GetValue("FrameworkDir64") 54 | $env:FrameworkDir = $env:FrameworkDir32 55 | $env:FrameworkVersion32 = $vcRegistry.GetValue("FrameworkVer32") 56 | $env:FrameworkVersion64 = $vcRegistry.GetValue("FrameworkVer64") 57 | $env:FrameworkVersion = $env:FrameworkVersion32 58 | Remove-Variable vcRegistry 59 | 60 | Append-EnvPathIfExists (Join-Path $env:FrameworkDir $env:Framework40Version) 61 | Append-EnvPathIfExists (Join-Path $env:FrameworkDir $env:FrameworkVersion) 62 | Append-EnvPathIfExists (Join-Path $env:VCINSTALLDIR "VCPackages") 63 | Append-EnvPathIfExists (Join-Path $env:VCINSTALLDIR "bin") 64 | 65 | if (Test-Path (Join-Path $env:VCINSTALLDIR "ATLMFC\INCLUDE")) { $env:INCLUDE = $env:INCLUDE + ";" + $(Join-Path $env:VCINSTALLDIR "ATLMFC\LIB") } 66 | if (Test-Path (Join-Path $env:VCINSTALLDIR "INCLUDE")) { $env:INCLUDE = $env:INCLUDE + ";" + $(Join-Path $env:VCINSTALLDIR "LIB") } 67 | 68 | if (Test-Path (Join-Path $env:VCINSTALLDIR "ATLMFC\LIB")) { 69 | $env:LIB = $env:LIB + ";" + $(Join-Path $env:VCINSTALLDIR "ATLMFC\LIB") 70 | $env:LIBPATH = $env:LIBPATH + ";" + $(Join-Path $env:VCINSTALLDIR "ATLMFC\LIB") 71 | } 72 | if (Test-Path (Join-Path $env:VCINSTALLDIR "LIB")) { 73 | $env:LIB = $env:LIB + ";" + $(Join-Path $env:VCINSTALLDIR "LIB") 74 | $env:LIBPATH = $env:LIBPATH + ";" + $(Join-Path $env:VCINSTALLDIR "LIB") 75 | } 76 | 77 | if (Test-Path (Join-Path $env:FrameworkDir $env:Framework40Version)) { $env:LIBPATH = $env:LIBPATH + ";" + $(Join-Path $env:FrameworkDir $env:Framework40Version) } 78 | if (Test-Path (Join-Path $env:FrameworkDir $env:FrameworkVersion)) { $env:LIBPATH = $env:LIBPATH + ";" + $(Join-Path $env:FrameworkDir $env:FrameworkVersion) } 79 | } 80 | 81 | if ((Test-Path "hklm:\SOFTWARE\Microsoft\VisualStudio\SxS\VC7") -or (Test-Path "hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VC7")) { 82 | $msBuildToolsRegistryPath = "hklm:\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions" 83 | if (${Test-Path $msBuildToolsRegistertPath} -eq $false) { $msBuildToolsRegistryPath = "hklm:\SOFTWARE\Microsoft\MSBuild\ToolsVersions" } 84 | 85 | $msBuildVersion = Get-ChildItem $msBuildToolsRegistryPath | Sort-Object {[float] (Split-Path -Leaf $_.Name)} -Descending | Select-Object @{N='Name';e={Split-Path -Leaf $_.Name}} -First 1 | Select -ExpandProperty "Name" 86 | $msBuildRegistry = Get-Item (Join-Path $msBuildToolsRegistryPath $msBuildVersion) 87 | $msBuildToolsRoot = $msBuildRegistry.GetValue("MSBuildToolsRoot") 88 | 89 | $msBuildRegistry.property | where {$_ -like "VCTargetsPath*"} | ForEach-Object { 90 | $vcTargetsPathValue = $msBuildRegistry.GetValue($_) 91 | $vcTargetsPath = $vcTargetsPathValue.Substring($vcTargetsPathValue.IndexOf("`$(MSBuildExtensionsPath32)")+26).TrimEnd("')") 92 | Invoke-Expression "`$env:${_} = Join-Path `"$msBuildToolsRoot`" `"$vcTargetsPath`"" 93 | Remove-Variable vcTargetsPath 94 | Remove-Variable vcTargetsPathValue 95 | } 96 | 97 | Remove-Variable msBuildVersion 98 | Remove-Variable msBuildToolsRoot 99 | Remove-Variable msBuildRegistry 100 | Remove-Variable msBuildToolsRegistryPath 101 | } 102 | 103 | if ((Test-Path "hklm:\SOFTWARE\Microsoft\VisualStudio\$vsVersion\Setup\F#") -or (Test-Path "hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\$vsVersion\Setup\F#")) { 104 | $fsRegistry = Get-Item "hklm:\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\$vsVersion\Setup\F#" -ErrorAction SilentlyContinue 105 | if ($fsRegistry -eq $null) { $fsRegistry = Get-Item "hklm:\SOFTWARE\Microsoft\VisualStudio\$vsVersion\Setup\F#" } 106 | $env:FSHARPINSTALLDIR = $fsRegistry.GetValue("ProductDir") 107 | Append-EnvPathIfExists $env:FSHARPINSTALLDIR 108 | Remove-Variable fsRegistry 109 | } 110 | 111 | 112 | # Configure Visual Studio functions 113 | function Start-VisualStudio ([string] $solutionFile) { 114 | $devenv = Join-Path $env:DevEnvDir "devenv.exe" 115 | if (($solutionFile -eq $null) -or ($solutionFile -eq "")) { 116 | $solutionFile = (Get-ChildItem -Filter "*.sln" | Select-Object -First 1).Name 117 | } 118 | if (($solutionFile -ne $null) -and ($solutionFile -ne "") -and (Test-Path $solutionFile)) { 119 | Start-Process $devenv -ArgumentList $solutionFile 120 | } else { 121 | Start-Process $devenv 122 | } 123 | } 124 | Set-Alias -name vs -Value Start-VisualStudio 125 | 126 | function Start-VisualStudioAsAdmin ([string] $solutionFile) { 127 | $devenv = Join-Path $env:DevEnvDir "devenv.exe" 128 | if (($solutionFile -eq $null) -or ($solutionFile -eq "")) { 129 | $solutionFile = (Get-ChildItem -Filter "*.sln" | Select-Object -First 1).Name 130 | } 131 | if (($solutionFile -ne $null) -and ($solutionFile -ne "") -and (Test-Path $solutionFile)) { 132 | Start-Process $devenv -ArgumentList $solutionFile -Verb "runAs" 133 | } else { 134 | Start-Process $devenv -Verb "runAs" 135 | } 136 | } 137 | Set-Alias -name vsadmin -Value Start-VisualStudioAsAdmin 138 | 139 | function Install-VSExtension($url) { 140 | $vsixInstaller = Join-Path $env:DevEnvDir "VSIXInstaller.exe" 141 | Write-Output "Downloading ${url}" 142 | $extensionFile = (curlex $url) 143 | Write-Output "Installing $($extensionFile.Name)" 144 | $result = Start-Process -FilePath `"$vsixInstaller`" -ArgumentList "/q $($extensionFile.FullName)" -Wait -PassThru; 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /deps.ps1: -------------------------------------------------------------------------------- 1 | # Check to see if we are currently running "as Administrator" 2 | if (!(Verify-Elevated)) { 3 | $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell"; 4 | $newProcess.Arguments = $myInvocation.MyCommand.Definition; 5 | $newProcess.Verb = "runas"; 6 | [System.Diagnostics.Process]::Start($newProcess); 7 | 8 | exit 9 | } 10 | 11 | # system and cli 12 | winget install Microsoft.WebPICmd --silent --accept-package-agreements --accept-source-agreements 13 | winget install Git.Git --silent --accept-package-agreements --accept-source-agreements --override "/VerySilent /NoRestart /o:PathOption=CmdTools /Components=""icons,assoc,assoc_sh,gitlfs""" 14 | winget install OpenJS.NodeJS --silent --accept-package-agreements --accept-source-agreements 15 | winget install Python.Python.3.12 --silent --accept-package-agreements --accept-source-agreements 16 | winget install RubyInstallerTeam.Ruby.3.2 --silent --accept-package-agreements --accept-source-agreements 17 | 18 | # browsers 19 | winget install Google.Chrome --silent --accept-package-agreements --accept-source-agreements 20 | winget install Mozilla.Firefox --silent --accept-package-agreements --accept-source-agreements 21 | #winget install Opera.Opera --silent --accept-package-agreements --accept-source-agreements 22 | 23 | # dev tools and frameworks 24 | winget install Microsoft.PowerShell --silent --accept-package-agreements --accept-source-agreements 25 | #winget install Microsoft.SQLServer.2019.Developer --silent --accept-package-agreements --accept-source-agreements 26 | winget install Microsoft.SQLServerManagementStudio --silent --accept-package-agreements --accept-source-agreements 27 | #winget install Microsoft.VisualStudio.2022.Professional --silent --accept-package-agreements --accept-source-agreements --override "--wait --quiet --norestart --nocache --addProductLang En-us --add Microsoft.VisualStudio.Workload.Azure --add Microsoft.VisualStudio.Workload.NetWeb" 28 | #winget install JetBrains.dotUltimate --silent --accept-package-agreements --accept-source-agreements --override "/SpecificProductNames=ReSharper;dotTrace;dotCover /Silent=True /VsVersion=17.0" 29 | winget install Vim.Vim --silent --accept-package-agreements --accept-source-agreements 30 | #winget install WinMerge.WinMerge --silent --accept-package-agreements --accept-source-agreements 31 | winget install Microsoft.AzureCLI --silent --accept-package-agreements --accept-source-agreements 32 | winget install Microsoft.Azure.StorageExplorer --silent --accept-package-agreements --accept-source-agreements 33 | #winget install Microsoft.Azure.StorageEmulator --silent --accept-package-agreements --accept-source-agreements 34 | #winget install Microsoft.ServiceFabricRuntime --silent --accept-package-agreements --accept-source-agreements 35 | 36 | Refresh-Environment 37 | 38 | gem pristine --all --env-shebang 39 | Get-ChildItem 'C:\Program Files\Vim\' -Filter "vim*" -ErrorAction SilentlyContinue | Select-Object -First 1 | ForEach-Object {Append-EnvPath $_.FullName} 40 | 41 | ### Node Packages 42 | Write-Host "Installing Node Packages..." -ForegroundColor "Yellow" 43 | if (which npm) { 44 | npm update npm 45 | npm install -g yo 46 | } 47 | 48 | ### Janus for vim 49 | Write-Host "Installing Janus..." -ForegroundColor "Yellow" 50 | if ((which curl) -and (which vim) -and (which rake) -and (which bash)) { 51 | curl.exe -L https://bit.ly/janus-bootstrap | bash 52 | 53 | cd ~/.vim/ 54 | git submodule update --remote 55 | } 56 | 57 | -------------------------------------------------------------------------------- /exports.ps1: -------------------------------------------------------------------------------- 1 | # Make vim the default editor 2 | Set-Environment "EDITOR" "gvim --nofork" 3 | Set-Environment "GIT_EDITOR" $Env:EDITOR 4 | 5 | # Disable the Progress Bar 6 | $ProgressPreference='SilentlyContinue' 7 | -------------------------------------------------------------------------------- /functions.ps1: -------------------------------------------------------------------------------- 1 | # Basic commands 2 | function which($name) { Get-Command $name -ErrorAction SilentlyContinue | Select-Object Definition } 3 | function touch($file) { "" | Out-File $file -Encoding ASCII } 4 | 5 | # Common Editing needs 6 | function Edit-Hosts { Invoke-Expression "sudo $(if($env:EDITOR -ne $null) {$env:EDITOR } else { 'notepad' }) $env:windir\system32\drivers\etc\hosts" } 7 | function Edit-Profile { Invoke-Expression "$(if($env:EDITOR -ne $null) {$env:EDITOR } else { 'notepad' }) $profile" } 8 | 9 | # Sudo 10 | function sudo() { 11 | if ($args.Length -eq 1) { 12 | start-process $args[0] -verb "runAs" 13 | } 14 | if ($args.Length -gt 1) { 15 | start-process $args[0] -ArgumentList $args[1..$args.Length] -verb "runAs" 16 | } 17 | } 18 | 19 | # Update Windows Store apps. This doesn't get all, but gets most. 20 | function Update-WindowsStore() { 21 | Get-CimInstance -Namespace "Root\cimv2\mdm\dmmap" -ClassName "MDM_EnterpriseModernAppManagement_AppManagement01" | Invoke-CimMethod -MethodName UpdateScanMethod 22 | } 23 | 24 | # System Update - Update RubyGems, NPM, and their installed packages 25 | function System-Update() { 26 | Install-WindowsUpdate -IgnoreUserInput -IgnoreReboot -AcceptAll 27 | Update-WindowsStore 28 | winget upgrade --all 29 | Update-Module 30 | Update-Help -Force 31 | if ((which gem)) { 32 | gem update --system 33 | gem update 34 | } 35 | if ((which npm)) { 36 | npm install npm -g 37 | npm update -g 38 | } 39 | } 40 | 41 | # Reload the Shell 42 | function Reload-Powershell { 43 | $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell"; 44 | $newProcess.Arguments = "-nologo"; 45 | [System.Diagnostics.Process]::Start($newProcess); 46 | exit 47 | } 48 | 49 | # Download a file into a temporary folder 50 | function curlex($url) { 51 | $uri = new-object system.uri $url 52 | $filename = $name = $uri.segments | Select-Object -Last 1 53 | $path = join-path $env:Temp $filename 54 | if( test-path $path ) { rm -force $path } 55 | 56 | (new-object net.webclient).DownloadFile($url, $path) 57 | 58 | return new-object io.fileinfo $path 59 | } 60 | 61 | # Empty the Recycle Bin on all drives 62 | function Empty-RecycleBin { 63 | $RecBin = (New-Object -ComObject Shell.Application).Namespace(0xA) 64 | $RecBin.Items() | %{Remove-Item $_.Path -Recurse -Confirm:$false} 65 | } 66 | 67 | # Sound Volume 68 | function Get-SoundVolume { 69 | <# 70 | .SYNOPSIS 71 | Get audio output volume. 72 | 73 | .DESCRIPTION 74 | The Get-SoundVolume cmdlet gets the current master volume of the default audio output device. The returned value is an integer between 0 and 100. 75 | 76 | .LINK 77 | Set-SoundVolume 78 | 79 | .LINK 80 | Set-SoundMute 81 | 82 | .LINK 83 | Set-SoundUnmute 84 | 85 | .LINK 86 | https://github.com/jayharris/dotfiles-windows/ 87 | #> 88 | [math]::Round([Audio]::Volume * 100) 89 | } 90 | function Set-SoundVolume([Parameter(mandatory=$true)][Int32] $Volume) { 91 | <# 92 | .SYNOPSIS 93 | Set audio output volume. 94 | 95 | .DESCRIPTION 96 | The Set-SoundVolume cmdlet sets the current master volume of the default audio output device to a value between 0 and 100. 97 | 98 | .PARAMETER Volume 99 | An integer between 0 and 100. 100 | 101 | .EXAMPLE 102 | Set-SoundVolume 65 103 | Sets the master volume to 65%. 104 | 105 | .EXAMPLE 106 | Set-SoundVolume -Volume 100 107 | Sets the master volume to a maximum 100%. 108 | 109 | .LINK 110 | Get-SoundVolume 111 | 112 | .LINK 113 | Set-SoundMute 114 | 115 | .LINK 116 | Set-SoundUnmute 117 | 118 | .LINK 119 | https://github.com/jayharris/dotfiles-windows/ 120 | #> 121 | [Audio]::Volume = ($Volume / 100) 122 | } 123 | function Set-SoundMute { 124 | <# 125 | .SYNOPSIS 126 | Mote audio output. 127 | 128 | .DESCRIPTION 129 | The Set-SoundMute cmdlet mutes the default audio output device. 130 | 131 | .LINK 132 | Get-SoundVolume 133 | 134 | .LINK 135 | Set-SoundVolume 136 | 137 | .LINK 138 | Set-SoundUnmute 139 | 140 | .LINK 141 | https://github.com/jayharris/dotfiles-windows/ 142 | #> 143 | [Audio]::Mute = $true 144 | } 145 | function Set-SoundUnmute { 146 | <# 147 | .SYNOPSIS 148 | Unmote audio output. 149 | 150 | .DESCRIPTION 151 | The Set-SoundUnmute cmdlet unmutes the default audio output device. 152 | 153 | .LINK 154 | Get-SoundVolume 155 | 156 | .LINK 157 | Set-SoundVolume 158 | 159 | .LINK 160 | Set-SoundMute 161 | 162 | .LINK 163 | https://github.com/jayharris/dotfiles-windows/ 164 | #> 165 | [Audio]::Mute = $false 166 | } 167 | 168 | 169 | ### File System functions 170 | ### ---------------------------- 171 | # Create a new directory and enter it 172 | function CreateAndSet-Directory([String] $path) { New-Item $path -ItemType Directory -ErrorAction SilentlyContinue; Set-Location $path} 173 | 174 | # Determine size of a file or total size of a directory 175 | function Get-DiskUsage([string] $path=(Get-Location).Path) { 176 | Convert-ToDiskSize ` 177 | ( ` 178 | Get-ChildItem .\ -recurse -ErrorAction SilentlyContinue ` 179 | | Measure-Object -property length -sum -ErrorAction SilentlyContinue 180 | ).Sum ` 181 | 1 182 | } 183 | 184 | # Cleanup all disks (Based on Registry Settings in `windows.ps1`) 185 | function Clean-Disks { 186 | Start-Process "$(Join-Path $env:WinDir 'system32\cleanmgr.exe')" -ArgumentList "/sagerun:6174" -Verb "runAs" 187 | } 188 | 189 | ### Environment functions 190 | ### ---------------------------- 191 | 192 | # Reload the $env object from the registry 193 | function Refresh-Environment { 194 | $locations = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 195 | 'HKCU:\Environment' 196 | 197 | $locations | ForEach-Object { 198 | $k = Get-Item $_ 199 | $k.GetValueNames() | ForEach-Object { 200 | $name = $_ 201 | $value = $k.GetValue($_) 202 | Set-Item -Path Env:\$name -Value $value 203 | } 204 | } 205 | 206 | $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") 207 | } 208 | 209 | # Set a permanent Environment variable, and reload it into $env 210 | function Set-Environment([String] $variable, [String] $value) { 211 | Set-ItemProperty "HKCU:\Environment" $variable $value 212 | # Manually setting Registry entry. SetEnvironmentVariable is too slow because of blocking HWND_BROADCAST 213 | #[System.Environment]::SetEnvironmentVariable("$variable", "$value","User") 214 | Invoke-Expression "`$env:${variable} = `"$value`"" 215 | } 216 | 217 | # Add a folder to $env:Path 218 | function Prepend-EnvPath([String]$path) { $env:PATH = $env:PATH + ";$path" } 219 | function Prepend-EnvPathIfExists([String]$path) { if (Test-Path $path) { Prepend-EnvPath $path } } 220 | function Append-EnvPath([String]$path) { $env:PATH = $env:PATH + ";$path" } 221 | function Append-EnvPathIfExists([String]$path) { if (Test-Path $path) { Append-EnvPath $path } } 222 | 223 | 224 | ### Utilities 225 | ### ---------------------------- 226 | 227 | # Convert a number to a disk size (12.4K or 5M) 228 | function Convert-ToDiskSize { 229 | param ( $bytes, $precision='0' ) 230 | foreach ($size in ("B","K","M","G","T")) { 231 | if (($bytes -lt 1000) -or ($size -eq "T")){ 232 | $bytes = ($bytes).tostring("F0" + "$precision") 233 | return "${bytes}${size}" 234 | } 235 | else { $bytes /= 1KB } 236 | } 237 | } 238 | 239 | # Start IIS Express Server with an optional path and port 240 | function Start-IISExpress { 241 | [CmdletBinding()] 242 | param ( 243 | [String] $path = (Get-Location).Path, 244 | [Int32] $port = 3000 245 | ) 246 | 247 | if ((Test-Path "${env:ProgramFiles}\IIS Express\iisexpress.exe") -or (Test-Path "${env:ProgramFiles(x86)}\IIS Express\iisexpress.exe")) { 248 | $iisExpress = Resolve-Path "${env:ProgramFiles}\IIS Express\iisexpress.exe" -ErrorAction SilentlyContinue 249 | if ($iisExpress -eq $null) { $iisExpress = Get-Item "${env:ProgramFiles(x86)}\IIS Express\iisexpress.exe" } 250 | 251 | & $iisExpress @("/path:${path}") /port:$port 252 | } else { Write-Warning "Unable to find iisexpress.exe"} 253 | } 254 | 255 | # Extract a .zip file 256 | function Unzip-File { 257 | <# 258 | .SYNOPSIS 259 | Extracts the contents of a zip file. 260 | 261 | .DESCRIPTION 262 | Extracts the contents of a zip file specified via the -File parameter to the 263 | location specified via the -Destination parameter. 264 | 265 | .PARAMETER File 266 | The zip file to extract. This can be an absolute or relative path. 267 | 268 | .PARAMETER Destination 269 | The destination folder to extract the contents of the zip file to. 270 | 271 | .PARAMETER ForceCOM 272 | Switch parameter to force the use of COM for the extraction even if the .NET Framework 4.5 is present. 273 | 274 | .EXAMPLE 275 | Unzip-File -File archive.zip -Destination .\d 276 | 277 | .EXAMPLE 278 | 'archive.zip' | Unzip-File 279 | 280 | .EXAMPLE 281 | Get-ChildItem -Path C:\zipfiles | ForEach-Object {$_.fullname | Unzip-File -Destination C:\databases} 282 | 283 | .INPUTS 284 | String 285 | 286 | .OUTPUTS 287 | None 288 | 289 | .NOTES 290 | Inspired by: Mike F Robbins, @mikefrobbins 291 | 292 | This function first checks to see if the .NET Framework 4.5 is installed and uses it for the unzipping process, otherwise COM is used. 293 | #> 294 | [CmdletBinding()] 295 | param ( 296 | [Parameter(Mandatory=$true, ValueFromPipeline=$true)] 297 | [string]$File, 298 | 299 | [ValidateNotNullOrEmpty()] 300 | [string]$Destination = (Get-Location).Path 301 | ) 302 | 303 | $filePath = Resolve-Path $File 304 | $destinationPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Destination) 305 | 306 | if (($PSVersionTable.PSVersion.Major -ge 3) -and 307 | ((Get-ItemProperty -Path "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue).Version -like "4.5*" -or 308 | (Get-ItemProperty -Path "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Client" -ErrorAction SilentlyContinue).Version -like "4.5*")) { 309 | 310 | try { 311 | [System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null 312 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$filePath", "$destinationPath") 313 | } catch { 314 | Write-Warning -Message "Unexpected Error. Error details: $_.Exception.Message" 315 | } 316 | } else { 317 | try { 318 | $shell = New-Object -ComObject Shell.Application 319 | $shell.Namespace($destinationPath).copyhere(($shell.NameSpace($filePath)).items()) 320 | } catch { 321 | Write-Warning -Message "Unexpected Error. Error details: $_.Exception.Message" 322 | } 323 | } 324 | } 325 | 326 | -------------------------------------------------------------------------------- /home/.gemrc: -------------------------------------------------------------------------------- 1 | gem: --env-shebang --no-document 2 | -------------------------------------------------------------------------------- /home/.gitattributes: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------------- /home/.gitconfig: -------------------------------------------------------------------------------- 1 | [alias] 2 | # List current aliases 3 | aliases = "!git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ / | grep -v ^'alias '" 4 | # View abbreviated SHA, description, and history graph of the latest 20 commits 5 | l = log --pretty=oneline -n 20 --graph --abbrev-commit 6 | # View the current working tree status using the short format 7 | s = status -s 8 | st = status -s 9 | # Show the diff between the latest commit and the current state 10 | d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" 11 | # `git di $number` shows the diff between the state `$number` revisions ago and the current state 12 | di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" 13 | # Pull in remote changes for the current repository and all its submodules 14 | p = !"git pull; git submodule foreach git pull origin master" 15 | # Clone a repository including all submodules 16 | c = clone --recursive 17 | # Commit all changes 18 | ca = !git add -A && git commit -av 19 | # Switch to a branch, but don't create it 20 | co = checkout 21 | # Switch to a branch, creating it if necessary 22 | go = checkout -B 23 | # Show verbose output about tags, branches or remotes 24 | tags = tag -l 25 | branches = branch -a 26 | remotes = remote -v 27 | # Credit an author on the latest commit 28 | credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" 29 | # Interactive rebase with the given number of latest commits 30 | reb = "!r() { git rebase -i HEAD~$1; }; r" 31 | # Find branches containing commit 32 | fb = "!f() { git branch -a --contains $1; }; f" 33 | # Find tags containing commit 34 | ft = "!f() { git describe --always --contains $1; }; f" 35 | # Find commits by source code 36 | fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f" 37 | # Find commits by commit message 38 | fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f" 39 | # Remove branches that have already been merged with master 40 | dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" 41 | # Undo Commit; leaves files. Only for non-public commits 42 | uncommit = reset --soft HEAD^ 43 | 44 | [apply] 45 | # Detect whitespace errors when applying a patch 46 | whitespace = warn 47 | 48 | [core] 49 | # Use custom `.gitignore` and `.gitattributes` 50 | excludesfile = ~/.gitignore 51 | attributesfile = ~/.gitattributes 52 | # Treat spaces before tabs, lines that are indented with 8 or more spaces, and 53 | # all kinds of trailing whitespace as an error. 54 | # [default] trailing-space: looks for spaces at the end of a line 55 | # [default] space-before-tab: looks for spaces before tabs at the beginning of 56 | # a line 57 | whitespace = space-before-tab,tab-in-indent,trailing-space,tabwidth=4 58 | 59 | # Speed up commands involving untracked files such as `git status`. 60 | # https://git-scm.com/docs/git-update-index#_untracked_cache 61 | untrackedCache = true 62 | 63 | [color] 64 | # Use colors in Git commands that are capable of colored output when 65 | # outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.) 66 | ui = auto 67 | [color "branch"] 68 | current = yellow reverse 69 | local = yellow 70 | remote = green 71 | [color "diff"] 72 | meta = yellow bold 73 | frag = magenta bold 74 | old = red bold 75 | new = green bold 76 | [color "status"] 77 | added = yellow 78 | changed = green 79 | untracked = cyan 80 | branch = magenta 81 | [merge] 82 | # Include summaries of merged commits in newly created merge commit messages 83 | log = true 84 | 85 | # URL shorthands 86 | [url "git@github.com:"] 87 | insteadOf = "gh:" 88 | pushInsteadOf = "github:" 89 | pushInsteadOf = "git://github.com/" 90 | [url "git://github.com/"] 91 | insteadOf = "github:" 92 | [url "git@gist.github.com:"] 93 | insteadOf = "gst:" 94 | pushInsteadOf = "gist:" 95 | pushInsteadOf = "git://gist.github.com/" 96 | [url "git://gist.github.com/"] 97 | insteadOf = "gist:" 98 | 99 | [push] 100 | default = simple 101 | 102 | [credential] 103 | helper = manager 104 | -------------------------------------------------------------------------------- /home/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/windows,visualstudio,visualstudiocode 3 | # Edit at https://www.gitignore.io/?templates=windows,visualstudio,visualstudiocode 4 | 5 | ### VisualStudioCode ### 6 | .vscode/* 7 | !.vscode/settings.json 8 | !.vscode/tasks.json 9 | !.vscode/launch.json 10 | !.vscode/extensions.json 11 | 12 | ### VisualStudioCode Patch ### 13 | # Ignore all local history of files 14 | .history 15 | 16 | ### Windows ### 17 | # Windows thumbnail cache files 18 | Thumbs.db 19 | ehthumbs.db 20 | ehthumbs_vista.db 21 | 22 | # Dump file 23 | *.stackdump 24 | 25 | # Folder config file 26 | [Dd]esktop.ini 27 | 28 | # Recycle Bin used on file shares 29 | $RECYCLE.BIN/ 30 | 31 | # Windows Installer files 32 | *.cab 33 | *.msi 34 | *.msix 35 | *.msm 36 | *.msp 37 | 38 | # Windows shortcuts 39 | *.lnk 40 | 41 | ### VisualStudio ### 42 | ## Ignore Visual Studio temporary files, build results, and 43 | ## files generated by popular Visual Studio add-ons. 44 | ## 45 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 46 | 47 | # User-specific files 48 | *.rsuser 49 | *.suo 50 | *.user 51 | *.userosscache 52 | *.sln.docstates 53 | 54 | # User-specific files (MonoDevelop/Xamarin Studio) 55 | *.userprefs 56 | 57 | # Build results 58 | [Dd]ebug/ 59 | [Dd]ebugPublic/ 60 | [Rr]elease/ 61 | [Rr]eleases/ 62 | x64/ 63 | x86/ 64 | [Aa][Rr][Mm]/ 65 | [Aa][Rr][Mm]64/ 66 | bld/ 67 | [Bb]in/ 68 | [Oo]bj/ 69 | [Ll]og/ 70 | 71 | # Visual Studio 2015/2017 cache/options directory 72 | .vs/ 73 | # Uncomment if you have tasks that create the project's static files in wwwroot 74 | #wwwroot/ 75 | 76 | # Visual Studio 2017 auto generated files 77 | Generated\ Files/ 78 | 79 | # MSTest test Results 80 | [Tt]est[Rr]esult*/ 81 | [Bb]uild[Ll]og.* 82 | 83 | # NUNIT 84 | *.VisualState.xml 85 | TestResult.xml 86 | 87 | # Build Results of an ATL Project 88 | [Dd]ebugPS/ 89 | [Rr]eleasePS/ 90 | dlldata.c 91 | 92 | # Benchmark Results 93 | BenchmarkDotNet.Artifacts/ 94 | 95 | # .NET Core 96 | project.lock.json 97 | project.fragment.lock.json 98 | artifacts/ 99 | 100 | # StyleCop 101 | StyleCopReport.xml 102 | 103 | # Files built by Visual Studio 104 | *_i.c 105 | *_p.c 106 | *_h.h 107 | *.ilk 108 | *.meta 109 | *.obj 110 | *.iobj 111 | *.pch 112 | *.pdb 113 | *.ipdb 114 | *.pgc 115 | *.pgd 116 | *.rsp 117 | *.sbr 118 | *.tlb 119 | *.tli 120 | *.tlh 121 | *.tmp 122 | *.tmp_proj 123 | *_wpftmp.csproj 124 | *.log 125 | *.vspscc 126 | *.vssscc 127 | .builds 128 | *.pidb 129 | *.svclog 130 | *.scc 131 | 132 | # Chutzpah Test files 133 | _Chutzpah* 134 | 135 | # Visual C++ cache files 136 | ipch/ 137 | *.aps 138 | *.ncb 139 | *.opendb 140 | *.opensdf 141 | *.sdf 142 | *.cachefile 143 | *.VC.db 144 | *.VC.VC.opendb 145 | 146 | # Visual Studio profiler 147 | *.psess 148 | *.vsp 149 | *.vspx 150 | *.sap 151 | 152 | # Visual Studio Trace Files 153 | *.e2e 154 | 155 | # TFS 2012 Local Workspace 156 | $tf/ 157 | 158 | # Guidance Automation Toolkit 159 | *.gpState 160 | 161 | # ReSharper is a .NET coding add-in 162 | _ReSharper*/ 163 | *.[Rr]e[Ss]harper 164 | *.DotSettings.user 165 | 166 | # JustCode is a .NET coding add-in 167 | .JustCode 168 | 169 | # TeamCity is a build add-in 170 | _TeamCity* 171 | 172 | # DotCover is a Code Coverage Tool 173 | *.dotCover 174 | 175 | # AxoCover is a Code Coverage Tool 176 | .axoCover/* 177 | !.axoCover/settings.json 178 | 179 | # Visual Studio code coverage results 180 | *.coverage 181 | *.coveragexml 182 | 183 | # NCrunch 184 | _NCrunch_* 185 | .*crunch*.local.xml 186 | nCrunchTemp_* 187 | 188 | # MightyMoose 189 | *.mm.* 190 | AutoTest.Net/ 191 | 192 | # Web workbench (sass) 193 | .sass-cache/ 194 | 195 | # Installshield output folder 196 | [Ee]xpress/ 197 | 198 | # DocProject is a documentation generator add-in 199 | DocProject/buildhelp/ 200 | DocProject/Help/*.HxT 201 | DocProject/Help/*.HxC 202 | DocProject/Help/*.hhc 203 | DocProject/Help/*.hhk 204 | DocProject/Help/*.hhp 205 | DocProject/Help/Html2 206 | DocProject/Help/html 207 | 208 | # Click-Once directory 209 | publish/ 210 | 211 | # Publish Web Output 212 | *.[Pp]ublish.xml 213 | *.azurePubxml 214 | # Note: Comment the next line if you want to checkin your web deploy settings, 215 | # but database connection strings (with potential passwords) will be unencrypted 216 | *.pubxml 217 | *.publishproj 218 | 219 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 220 | # checkin your Azure Web App publish settings, but sensitive information contained 221 | # in these scripts will be unencrypted 222 | PublishScripts/ 223 | 224 | # NuGet Packages 225 | *.nupkg 226 | # The packages folder can be ignored because of Package Restore 227 | **/[Pp]ackages/* 228 | # except build/, which is used as an MSBuild target. 229 | !**/[Pp]ackages/build/ 230 | # Uncomment if necessary however generally it will be regenerated when needed 231 | #!**/[Pp]ackages/repositories.config 232 | # NuGet v3's project.json files produces more ignorable files 233 | *.nuget.props 234 | *.nuget.targets 235 | 236 | # Microsoft Azure Build Output 237 | csx/ 238 | *.build.csdef 239 | 240 | # Microsoft Azure Emulator 241 | ecf/ 242 | rcf/ 243 | 244 | # Windows Store app package directories and files 245 | AppPackages/ 246 | BundleArtifacts/ 247 | Package.StoreAssociation.xml 248 | _pkginfo.txt 249 | *.appx 250 | 251 | # Visual Studio cache files 252 | # files ending in .cache can be ignored 253 | *.[Cc]ache 254 | # but keep track of directories ending in .cache 255 | !?*.[Cc]ache/ 256 | 257 | # Others 258 | ClientBin/ 259 | ~$* 260 | *~ 261 | *.dbmdl 262 | *.dbproj.schemaview 263 | *.jfm 264 | *.pfx 265 | *.publishsettings 266 | orleans.codegen.cs 267 | 268 | # Including strong name files can present a security risk 269 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 270 | #*.snk 271 | 272 | # Since there are multiple workflows, uncomment next line to ignore bower_components 273 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 274 | #bower_components/ 275 | # ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true 276 | **/wwwroot/lib/ 277 | 278 | # RIA/Silverlight projects 279 | Generated_Code/ 280 | 281 | # Backup & report files from converting an old project file 282 | # to a newer Visual Studio version. Backup files are not needed, 283 | # because we have git ;-) 284 | _UpgradeReport_Files/ 285 | Backup*/ 286 | UpgradeLog*.XML 287 | UpgradeLog*.htm 288 | ServiceFabricBackup/ 289 | *.rptproj.bak 290 | 291 | # SQL Server files 292 | *.mdf 293 | *.ldf 294 | *.ndf 295 | 296 | # Business Intelligence projects 297 | *.rdl.data 298 | *.bim.layout 299 | *.bim_*.settings 300 | *.rptproj.rsuser 301 | 302 | # Microsoft Fakes 303 | FakesAssemblies/ 304 | 305 | # GhostDoc plugin setting file 306 | *.GhostDoc.xml 307 | 308 | # Node.js Tools for Visual Studio 309 | .ntvs_analysis.dat 310 | node_modules/ 311 | 312 | # Visual Studio 6 build log 313 | *.plg 314 | 315 | # Visual Studio 6 workspace options file 316 | *.opt 317 | 318 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 319 | *.vbw 320 | 321 | # Visual Studio LightSwitch build output 322 | **/*.HTMLClient/GeneratedArtifacts 323 | **/*.DesktopClient/GeneratedArtifacts 324 | **/*.DesktopClient/ModelManifest.xml 325 | **/*.Server/GeneratedArtifacts 326 | **/*.Server/ModelManifest.xml 327 | _Pvt_Extensions 328 | 329 | # Paket dependency manager 330 | .paket/paket.exe 331 | paket-files/ 332 | 333 | # FAKE - F# Make 334 | .fake/ 335 | 336 | # JetBrains Rider 337 | .idea/ 338 | *.sln.iml 339 | 340 | # CodeRush personal settings 341 | .cr/personal 342 | 343 | # Python Tools for Visual Studio (PTVS) 344 | __pycache__/ 345 | *.pyc 346 | 347 | # Cake - Uncomment if you are using it 348 | # tools/** 349 | # !tools/packages.config 350 | 351 | # Tabs Studio 352 | *.tss 353 | 354 | # Telerik's JustMock configuration file 355 | *.jmconfig 356 | 357 | # BizTalk build output 358 | *.btp.cs 359 | *.btm.cs 360 | *.odx.cs 361 | *.xsd.cs 362 | 363 | # OpenCover UI analysis results 364 | OpenCover/ 365 | 366 | # Azure Stream Analytics local run output 367 | ASALocalRun/ 368 | 369 | # MSBuild Binary and Structured Log 370 | *.binlog 371 | 372 | # NVidia Nsight GPU debugger configuration file 373 | *.nvuser 374 | 375 | # MFractors (Xamarin productivity tool) working folder 376 | .mfractor/ 377 | 378 | # Local History for Visual Studio 379 | .localhistory/ 380 | 381 | # BeatPulse healthcheck temp database 382 | healthchecksdb 383 | 384 | # End of https://www.gitignore.io/api/windows,visualstudio,visualstudiocode 385 | -------------------------------------------------------------------------------- /home/.gvimrc.after: -------------------------------------------------------------------------------- 1 | set guioptions-=m "hide menu bar 2 | set guioptions-=T "hide toolbar 3 | set guioptions-=r "hide right-hand scrollbar 4 | set guioptions-=L "hide left-hand scrollbar 5 | 6 | set guifont=Source\ Code\ Pro:h11 7 | -------------------------------------------------------------------------------- /home/.hgignore: -------------------------------------------------------------------------------- 1 | # Use shell-style glob syntax 2 | syntax: glob 3 | 4 | ### Windows ### 5 | # Windows image file caches 6 | Thumbs.db 7 | ehthumbs.db 8 | 9 | # Folder config file 10 | Desktop.ini 11 | 12 | # Recycle Bin used on file shares 13 | $RECYCLE.BIN/ 14 | 15 | ### OSX ### 16 | .DS_Store 17 | .AppleDouble 18 | .LSOverride 19 | Icon 20 | 21 | 22 | # Thumbnails 23 | ._* 24 | 25 | # Files that might appear on external disk 26 | .Spotlight-V100 27 | .Trashes 28 | 29 | # Shhh. The Extra file is a secret 30 | .extra -------------------------------------------------------------------------------- /home/.hgrc: -------------------------------------------------------------------------------- 1 | [alias] 2 | s = status 3 | # View abbreviated SHA, description, and history graph of the latest 20 commits 4 | l = log --limit 20 --graph --template '\033[0;33m{node|short}\033[0m {desc|strip|firstline}\n' 5 | # Show the diff between the latest commit and the current state 6 | d = diff --rev -1 --stat 7 | # `git di $number` shows the diff between the state `$number` revisions ago and the current state 8 | di = !eval "f() { hg diff --rev -$1 --stat; }; f" 9 | # Commit all changes 10 | ca = commit --addremove --verbose 11 | # Find commits by commit message 12 | fm = !eval "f() { hg log --template '\033[0;33m{node|short}\033[0m \033[0;34m{date|shortdate}\033[0m {desc|strip|firstline} \033[0;32m[{author|strip|person}]\033[0m\n' --keyword=$1; }; f" 13 | 14 | [ui] 15 | ssh = ssh -C 16 | 17 | [diff] 18 | git = True 19 | 20 | [color] 21 | mode = auto 22 | 23 | branches.current = yellow inverse 24 | 25 | diff.extended = yellow bold 26 | diff.hunk = magenta bold 27 | diff.deleted = red bold 28 | diff.inserted = green bold 29 | 30 | status.added = yellow 31 | status.modified = green 32 | status.unknown = cyan 33 | 34 | [extensions] 35 | color = 36 | purge = 37 | progress = 38 | rebase = -------------------------------------------------------------------------------- /home/.npmrc: -------------------------------------------------------------------------------- 1 | loglevel = error 2 | depth = 0 3 | progress=false 4 | -------------------------------------------------------------------------------- /home/.vimrc.after: -------------------------------------------------------------------------------- 1 | colorscheme jellybeans 2 | 3 | let NERDTreeShowHidden=1 4 | 5 | let g:snipMate = { 'snippet_version' : 1 } 6 | -------------------------------------------------------------------------------- /profile.ps1: -------------------------------------------------------------------------------- 1 | # Profile for the Microsoft.Powershell Shell, only. (Not Visual Studio or other PoSh instances) 2 | # =========== 3 | 4 | Push-Location (Split-Path -parent $profile) 5 | "components","functions","aliases","exports","extra" | Where-Object {Test-Path "$_.ps1"} | ForEach-Object -process {Invoke-Expression ". .\$_.ps1"} 6 | Pop-Location 7 | -------------------------------------------------------------------------------- /setup/install.ps1: -------------------------------------------------------------------------------- 1 | $account = "jayharris" 2 | $repo = "dotfiles-windows" 3 | $branch = "master" 4 | 5 | $dotfilesTempDir = Join-Path $env:TEMP "dotfiles" 6 | if (![System.IO.Directory]::Exists($dotfilesTempDir)) {[System.IO.Directory]::CreateDirectory($dotfilesTempDir)} 7 | $sourceFile = Join-Path $dotfilesTempDir "dotfiles.zip" 8 | $dotfilesInstallDir = Join-Path $dotfilesTempDir "$repo-$branch" 9 | 10 | 11 | function Download-File { 12 | param ( 13 | [string]$url, 14 | [string]$file 15 | ) 16 | Write-Host "Downloading $url to $file" 17 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 18 | Invoke-WebRequest -Uri $url -OutFile $file 19 | 20 | } 21 | 22 | function Unzip-File { 23 | param ( 24 | [string]$File, 25 | [string]$Destination = (Get-Location).Path 26 | ) 27 | 28 | $filePath = Resolve-Path $File 29 | $destinationPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Destination) 30 | 31 | If (($PSVersionTable.PSVersion.Major -ge 3) -and 32 | ( 33 | [version](Get-ItemProperty -Path "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue).Version -ge [version]"4.5" -or 34 | [version](Get-ItemProperty -Path "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Client" -ErrorAction SilentlyContinue).Version -ge [version]"4.5" 35 | )) { 36 | try { 37 | [System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null 38 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$filePath", "$destinationPath") 39 | } catch { 40 | Write-Warning -Message "Unexpected Error. Error details: $_.Exception.Message" 41 | } 42 | } else { 43 | try { 44 | $shell = New-Object -ComObject Shell.Application 45 | $shell.Namespace($destinationPath).copyhere(($shell.NameSpace($filePath)).items()) 46 | } catch { 47 | Write-Warning -Message "Unexpected Error. Error details: $_.Exception.Message" 48 | } 49 | } 50 | } 51 | 52 | Download-File "https://github.com/$account/$repo/archive/$branch.zip" $sourceFile 53 | if ([System.IO.Directory]::Exists($dotfilesInstallDir)) {[System.IO.Directory]::Delete($dotfilesInstallDir, $true)} 54 | Unzip-File $sourceFile $dotfilesTempDir 55 | 56 | Push-Location $dotfilesInstallDir 57 | & .\bootstrap.ps1 58 | Pop-Location 59 | 60 | $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell"; 61 | $newProcess.Arguments = "-nologo"; 62 | [System.Diagnostics.Process]::Start($newProcess); 63 | exit 64 | 65 | -------------------------------------------------------------------------------- /windows.ps1: -------------------------------------------------------------------------------- 1 | # Check to see if we are currently running "as Administrator" 2 | if (!(Verify-Elevated)) { 3 | $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell"; 4 | $newProcess.Arguments = $myInvocation.MyCommand.Definition; 5 | $newProcess.Verb = "runas"; 6 | [System.Diagnostics.Process]::Start($newProcess); 7 | 8 | exit 9 | } 10 | 11 | ############################################################################### 12 | ### Security and Identity # 13 | ############################################################################### 14 | Write-Host "Configuring System..." -ForegroundColor "Yellow" 15 | 16 | # Set Computer Name 17 | (Get-WmiObject Win32_ComputerSystem).Rename("CHOZO") | Out-Null 18 | 19 | ## Set DisplayName for my account. Use only if you are not using a Microsoft Account 20 | #$myIdentity=[System.Security.Principal.WindowsIdentity]::GetCurrent() 21 | #$user = Get-WmiObject Win32_UserAccount | Where {$_.Caption -eq $myIdentity.Name} 22 | #$user.FullName = "Jay Harris 23 | #$user.Put() | Out-Null 24 | #Remove-Variable user 25 | #Remove-Variable myIdentity 26 | 27 | # Enable Developer Mode: Enable: 1, Disable: 0 28 | #Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" "AllowDevelopmentWithoutDevLicense" 1 29 | # Bash on Windows 30 | Disable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux" -NoRestart -WarningAction SilentlyContinue | Out-Null 31 | #Enable-WindowsOptionalFeature -Online -All -FeatureName "Microsoft-Windows-Subsystem-Linux" -NoRestart -WarningAction SilentlyContinue | Out-Null 32 | #wsl --install --distribution Ubuntu 33 | 34 | ############################################################################### 35 | ### Privacy # 36 | ############################################################################### 37 | Write-Host "Configuring Privacy..." -ForegroundColor "Yellow" 38 | 39 | # General: Don't let apps use advertising ID for experiences across apps: Allow: 1, Disallow: 0 40 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Type Folder | Out-Null} 41 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" "Enabled" 0 42 | Remove-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" "Id" -ErrorAction SilentlyContinue 43 | 44 | # General: Disable Application launch tracking: Enable: 1, Disable: 0 45 | Set-ItemProperty "HKCU:\\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "Start-TrackProgs" 0 46 | 47 | # General: Disable SmartScreen Filter for Store Apps: Enable: 1, Disable: 0 48 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" "EnableWebContentEvaluation" 0 49 | 50 | # General: Disable key logging & transmission to Microsoft: Enable: 1, Disable: 0 51 | # Disabled when Telemetry is set to Basic 52 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Input")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Input" -Type Folder | Out-Null} 53 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Input\TIPC")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Input\TIPC" -Type Folder | Out-Null} 54 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Input\TIPC" "Enabled" 0 55 | 56 | # General: Opt-out from websites from accessing language list: Opt-in: 0, Opt-out 1 57 | Set-ItemProperty "HKCU:\Control Panel\International\User Profile" "HttpAcceptLanguageOptOut" 1 58 | 59 | # General: Disable SmartGlass: Enable: 1, Disable: 0 60 | #Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\SmartGlass" "UserAuthPolicy" 0 61 | 62 | # General: Disable SmartGlass over BlueTooth: Enable: 1, Disable: 0 63 | #Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\SmartGlass" "BluetoothPolicy" 0 64 | 65 | # General: Disable suggested content in settings app: Enable: 1, Disable: 0 66 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" "SubscribedContent-338393Enabled" 0 67 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" "SubscribedContent-338394Enabled" 0 68 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" "SubscribedContent-338396Enabled" 0 69 | 70 | # General: Disable tips and suggestions for welcome and what's new: Enable: 1, Disable: 0 71 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" "SubscribedContent-310093Enabled" 0 72 | 73 | # General: Disable tips and suggestions when I use windows: Enable: 1, Disable: 0 74 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" "SubscribedContent-338389Enabled" 0 75 | 76 | # Start Menu: Disable suggested content: Enable: 1, Disable: 0 77 | #Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" "SubscribedContent-338388Enabled" 0 78 | 79 | # Start Menu: Disable search entries: Enable: 0, Disable: 1 80 | if (!(Test-Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer")) {New-Item -Path "HKCU:\Software\Policies\Microsoft\Windows\Explorer" -Type Folder | Out-Null} 81 | Set-ItemProperty "HKCU:\Software\Policies\Microsoft\Windows\Explorer" "DisableSearchBoxSuggestions" 1 82 | 83 | # Camera: Don't let apps use camera: Allow, Deny 84 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam" -Type Folder | Out-Null} 85 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam" "Value" "Deny" 86 | 87 | # Microphone: Don't let apps use microphone: Allow, Deny 88 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\microphone")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\microphone" -Type Folder | Out-Null} 89 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\microphone" "Value" "Deny" 90 | 91 | # Notifications: Don't let apps access notifications: Allow, Deny 92 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userNotificationListener")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userNotificationListener" -Type Folder | Out-Null} 93 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userNotificationListener" "Value" "Deny" 94 | 95 | # Speech, Inking, & Typing: Stop "Getting to know me" 96 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Type Folder | Out-Null} 97 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\InputPersonalization" "RestrictImplicitTextCollection" 1 98 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\InputPersonalization" "RestrictImplicitInkCollection" 1 99 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" -Type Folder | Out-Null} 100 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore" "HarvestContacts" 0 101 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" -Type Folder | Out-Null} 102 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" "AcceptedPrivacyPolicy" 0 103 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Speech_OneCore\Settings")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Speech_OneCore\Settings" -Type Folder | Out-Null} 104 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" -Type Folder | Out-Null} 105 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" "HasAccepted" 0 106 | 107 | # Account Info: Don't let apps access name, picture, and other account info: Allow, Deny 108 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userAccountInformation")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userAccountInformation" -Type Folder | Out-Null} 109 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userAccountInformation" "Value" "Deny" 110 | 111 | # Contacts: Don't let apps access contacts: Allow, Deny 112 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\contacts")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\contacts" -Type Folder | Out-Null} 113 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\contacts" "Value" "Deny" 114 | 115 | # Calendar: Don't let apps access calendar: Allow, Deny 116 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appointments")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appointments" -Type Folder | Out-Null} 117 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appointments" "Value" "Deny" 118 | 119 | # Call History: Don't let apps make phone calls: Allow, Deny 120 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\phoneCall")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\phoneCall" -Type Folder | Out-Null} 121 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\phoneCall" "Value" "Deny" 122 | 123 | # Call History: Don't let apps access call history: Allow, Deny 124 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\phoneCallHistory")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\phoneCallHistory" -Type Folder | Out-Null} 125 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\phoneCallHistory" "Value" "Deny" 126 | 127 | # Diagnostics: Don't let apps access diagnostics of other apps: Allow, Deny 128 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appDiagnostics")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appDiagnostics" -Type Folder | Out-Null} 129 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\appDiagnostics" "Value" "Deny" 130 | 131 | # Documents: Don't let apps access documents: Allow, Deny 132 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\documentsLibrary")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\documentsLibrary" -Type Folder | Out-Null} 133 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\documentsLibrary" "Value" "Deny" 134 | 135 | # Downloads: Don't let apps access downloads: Allow, Deny 136 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\downloadsFolder")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\downloadsFolder" -Type Folder | Out-Null} 137 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\downloadsFolder" "Value" "Deny" 138 | 139 | # Email: Don't let apps read and send email: Allow, Deny 140 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\email")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\email" -Type Folder | Out-Null} 141 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\email" "Value" "Deny" 142 | 143 | # File System: Don't let apps access the file system: Allow, Deny 144 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\broadFileSystemAccess")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\broadFileSystemAccess" -Type Folder | Out-Null} 145 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\broadFileSystemAccess" "Value" "Deny" 146 | 147 | # Location: Don't let apps access the location: Allow, Deny 148 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Type Folder | Out-Null} 149 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" "Value" "Deny" 150 | 151 | # Messaging: Don't let apps read or send messages (text or MMS): Allow, Deny 152 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\chat")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\chat" -Type Folder | Out-Null} 153 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\chat" "Value" "Deny" 154 | 155 | # Music Library: Don't let apps access music library: Allow, Deny 156 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\musicLibrary")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\musicLibrary" -Type Folder | Out-Null} 157 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\musicLibrary" "Value" "Deny" 158 | 159 | # Pictures: Don't let apps access pictures: Allow, Deny 160 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\picturesLibrary")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\picturesLibrary" -Type Folder | Out-Null} 161 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\picturesLibrary" "Value" "Deny" 162 | 163 | # Radios: Don't let apps control radios (like Bluetooth): Allow, Deny 164 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\radios")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\radios" -Type Folder | Out-Null} 165 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\radios" "Value" "Deny" 166 | 167 | # Screenshot: Don't let apps take screenshots: Allow, Deny 168 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\graphicsCaptureProgrammatic")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\graphicsCaptureProgrammatic" -Type Folder | Out-Null} 169 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\graphicsCaptureProgrammatic" "Value" "Deny" 170 | 171 | # Screenshot Borders: Don't let apps access screenshot border settings: Allow, Deny 172 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\graphicsCaptureWithoutBorder")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\graphicsCaptureWithoutBorder" -Type Folder | Out-Null} 173 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\graphicsCaptureWithoutBorder" "Value" "Deny" 174 | 175 | # Tasks: Don't let apps access the tasks: Allow, Deny 176 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userDataTasks")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userDataTasks" -Type Folder | Out-Null} 177 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\userDataTasks" "Value" "Deny" 178 | 179 | # Other Devices: Don't let apps share and sync with non-explicitly-paired wireless devices over uPnP: Allow, Deny 180 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\bluetoothSync")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\bluetoothSync" -Type Folder | Out-Null} 181 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\bluetoothSync" "Value" "Deny" 182 | 183 | # Videos: Don't let apps access videos: Allow, Deny 184 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\videosLibrary")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\videosLibrary" -Type Folder | Out-Null} 185 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\videosLibrary" "Value" "Deny" 186 | 187 | # Feedback: Windows should never ask for my feedback 188 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Siuf")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Siuf" -Type Folder | Out-Null} 189 | if (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules")) {New-Item -Path "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" -Type Folder | Out-Null} 190 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Siuf\Rules" "NumberOfSIUFInPeriod" 0 191 | 192 | # Feedback: Telemetry: Send Diagnostic and usage data: Basic: 1, Enhanced: 2, Full: 3 193 | Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" "AllowTelemetry" 1 194 | Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" "MaxTelemetryAllowed" 1 195 | 196 | ############################################################################### 197 | ### Devices, Power, and Startup # 198 | ############################################################################### 199 | Write-Host "Configuring Devices, Power, and Startup..." -ForegroundColor "Yellow" 200 | 201 | # Sound: Disable Startup Sound: Enable: 0, Disable: 1 202 | Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" "DisableStartupSound" 1 203 | Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\BootAnimation" "DisableStartupSound" 1 204 | Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\EditionOverrides" "UserSetting_DisableStartupSound" 1 205 | 206 | # Power: Disable Hibernation 207 | powercfg /hibernate off 208 | 209 | # Power: Set standby delay to 24 hours 210 | powercfg /change /standby-timeout-ac 1440 211 | 212 | # SSD: Disable SuperFetch: Enable: 1, Disable: 0 213 | Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters" "EnableSuperfetch" 0 214 | 215 | # Network: Disable WiFi Sense: Enable: 1, Disable: 0 216 | #Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" "AutoConnectAllowedOEM" 0 217 | 218 | ############################################################################### 219 | ### Explorer, Taskbar, and System Tray # 220 | ############################################################################### 221 | Write-Host "Configuring Explorer, Taskbar, and System Tray..." -ForegroundColor "Yellow" 222 | 223 | # Prerequisite: Ensure necessary registry paths 224 | if (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")) {New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Type Folder | Out-Null} 225 | if (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState")) {New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState" -Type Folder | Out-Null} 226 | if (!(Test-Path "HKLM:\Software\Policies\Microsoft\Windows\Windows Search")) {New-Item -Path "HKLM:\Software\Policies\Microsoft\Windows\Windows Search" -Type Folder | Out-Null} 227 | 228 | # Explorer: Show hidden files by default: Show Files: 1, Hide Files: 2 229 | Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "Hidden" 1 230 | 231 | # Explorer: Show file extensions by default: Hide: 1, Show: 0 232 | Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "HideFileExt" 0 233 | 234 | # Explorer: Show path in title bar: Hide: 0, Show: 1 235 | Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState" "FullPath" 1 236 | 237 | # Explorer: Disable creating Thumbs.db files on network volumes: Enable: 0, Disable: 1 238 | Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" "DisableThumbnailsOnNetworkFolders" 1 239 | 240 | # Taskbar: Hide the Search, Task, Widget, and Chat buttons: Show: 1, Hide: 0 241 | Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search" "SearchboxTaskbarMode" 0 # Search 242 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "ShowTaskViewButton" 0 # Task 243 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "TaskbarDa" 0 # Widgets 244 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "TaskbarMn" 0 # Chat 245 | 246 | # Taskbar: Show colors on Taskbar, Start, and SysTray: Disabled: 0, Taskbar, Start, & SysTray: 1, Taskbar Only: 2 247 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" "ColorPrevalence" 1 248 | 249 | # Titlebar: Disable theme colors on titlebar: Enable: 1, Disable: 0 250 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\DWM" "ColorPrevalence" 0 251 | 252 | # Recycle Bin: Disable Delete Confirmation Dialog: Enable: 1, Disable: 0 253 | Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" "ConfirmFileDelete" 0 254 | 255 | ############################################################################### 256 | ### Default Windows Applications # 257 | ############################################################################### 258 | Write-Host "Configuring Default Windows Applications..." -ForegroundColor "Yellow" 259 | 260 | # Uninstall 3D Builder 261 | Get-AppxPackage "Microsoft.3DBuilder" -AllUsers | Remove-AppxPackage -AllUsers 262 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.3DBuilder" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 263 | 264 | # Uninstall Adobe Creative Cloud Express 265 | Get-AppxPackage "AdobeSystemsIncorporated.AdobeCreativeCloudExpress" -AllUsers | Remove-AppxPackage -AllUsers 266 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "AdobeSystemsIncorporated.AdobeCreativeCloudExpress" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 267 | 268 | # Uninstall Alarms and Clock 269 | Get-AppxPackage "Microsoft.WindowsAlarms" -AllUsers | Remove-AppxPackage -AllUsers 270 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.WindowsAlarms" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 271 | 272 | # Uninstall Amazon Prime Video 273 | Get-AppxPackage "AmazonVideo.PrimeVideo" -AllUsers | Remove-AppxPackage -AllUsers 274 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "AmazonVideo.PrimeVideo" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 275 | 276 | # Uninstall Autodesk Sketchbook 277 | Get-AppxPackage "*.AutodeskSketchBook" -AllUsers | Remove-AppxPackage -AllUsers 278 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "*.AutodeskSketchBook" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 279 | 280 | # Uninstall Bing Finance 281 | Get-AppxPackage "Microsoft.BingFinance" -AllUsers | Remove-AppxPackage -AllUsers 282 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.BingFinance" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 283 | 284 | # Uninstall Bing News 285 | Get-AppxPackage "Microsoft.BingNews" -AllUsers | Remove-AppxPackage -AllUsers 286 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.BingNews" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 287 | 288 | # Uninstall Bing Sports 289 | Get-AppxPackage "Microsoft.BingSports" -AllUsers | Remove-AppxPackage -AllUsers 290 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.BingSports" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 291 | 292 | # Uninstall Bing Weather 293 | Get-AppxPackage "Microsoft.BingWeather" -AllUsers | Remove-AppxPackage -AllUsers 294 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.BingWeather" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 295 | 296 | # Uninstall Bubble Witch 3 Saga 297 | Get-AppxPackage "king.com.BubbleWitch3Saga" -AllUsers | Remove-AppxPackage -AllUsers 298 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "king.com.BubbleWitch3Saga" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 299 | 300 | # Uninstall Calendar and Mail 301 | Get-AppxPackage "Microsoft.WindowsCommunicationsApps" -AllUsers | Remove-AppxPackage -AllUsers 302 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.WindowsCommunicationsApps" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 303 | 304 | # Uninstall Candy Crush Soda Saga 305 | Get-AppxPackage "king.com.CandyCrushSodaSaga" -AllUsers | Remove-AppxPackage -AllUsers 306 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "king.com.CandyCrushSodaSaga" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 307 | 308 | # Uninstall ClipChamp Video Editor 309 | Get-AppxPackage "Clipchamp.Clipchamp" -AllUsers | Remove-AppxPackage 310 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Clipchamp.Clipchamp" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 311 | 312 | # Uninstall Cortana 313 | Get-AppxPackage "Microsoft.549981C3F5F10" -AllUsers | Remove-AppxPackage -AllUsers 314 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.549981C3F5F10" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 315 | 316 | # Uninstall Disney+ 317 | Get-AppxPackage "Disney.37853FC22B2CE" -AllUsers | Remove-AppxPackage -AllUsers 318 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Disney.37853FC22B2CE" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 319 | 320 | # Uninstall Disney Magic Kingdoms 321 | Get-AppxPackage "*.DisneyMagicKingdoms" -AllUsers | Remove-AppxPackage -AllUsers 322 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "*.DisneyMagicKingdoms" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 323 | 324 | # Uninstall Dolby 325 | Get-AppxPackage "DolbyLaboratories.DolbyAccess" -AllUsers | Remove-AppxPackage -AllUsers 326 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "DolbyLaboratories.DolbyAccess" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 327 | 328 | # Uninstall Facebook 329 | Get-AppxPackage "Facebook.Facebook*" -AllUsers | Remove-AppxPackage -AllUsers 330 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Facebook.Facebook*" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 331 | 332 | # Uninstall Get Office, and it's "Get Office365" notifications 333 | Get-AppxPackage "Microsoft.MicrosoftOfficeHub" -AllUsers | Remove-AppxPackage -AllUsers 334 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.MicrosoftOfficeHub" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 335 | 336 | # Uninstall Instagram 337 | Get-AppxPackage "Facebook.Instagram*" -AllUsers | Remove-AppxPackage -AllUsers 338 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Facebook.Instagram*" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 339 | 340 | # Uninstall Maps 341 | Get-AppxPackage "Microsoft.WindowsMaps" -AllUsers | Remove-AppxPackage -AllUsers 342 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.WindowsMaps" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 343 | 344 | # Uninstall March of Empires 345 | Get-AppxPackage "*.MarchofEmpires" -AllUsers | Remove-AppxPackage -AllUsers 346 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "*.MarchofEmpires" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 347 | 348 | # Uninstall Messaging 349 | Get-AppxPackage "Microsoft.Messaging" -AllUsers | Remove-AppxPackage -AllUsers 350 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.Messaging" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 351 | 352 | # Uninstall Mobile Plans 353 | Get-AppxPackage "Microsoft.OneConnect" -AllUsers | Remove-AppxPackage -AllUsers 354 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.OneConnect" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 355 | 356 | # Uninstall OneNote 357 | Get-AppxPackage "Microsoft.Office.OneNote" -AllUsers | Remove-AppxPackage -AllUsers 358 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.Office.OneNote" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 359 | 360 | # Uninstall Paint 361 | Get-AppxPackage "Microsoft.Paint" -AllUsers | Remove-AppxPackage -AllUsers 362 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.Paint" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 363 | 364 | # Uninstall People 365 | Get-AppxPackage "Microsoft.People" -AllUsers | Remove-AppxPackage -AllUsers 366 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.People" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 367 | 368 | # Uninstall Photos 369 | Get-AppxPackage "Microsoft.Windows.Photos" -AllUsers | Remove-AppxPackage -AllUsers 370 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.Windows.Photos" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 371 | 372 | # Uninstall Print3D 373 | Get-AppxPackage "Microsoft.Print3D" -AllUsers | Remove-AppxPackage -AllUsers 374 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.Print3D" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 375 | 376 | # Uninstall Skype 377 | Get-AppxPackage "Microsoft.SkypeApp" -AllUsers | Remove-AppxPackage -AllUsers 378 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.SkypeApp" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 379 | 380 | # Uninstall SlingTV 381 | Get-AppxPackage "*.SlingTV" -AllUsers | Remove-AppxPackage -AllUsers 382 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "*.SlingTV" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 383 | 384 | # Uninstall Solitaire 385 | Get-AppxPackage "Microsoft.MicrosoftSolitaireCollection" -AllUsers | Remove-AppxPackage -AllUsers 386 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.MicrosoftSolitaireCollection" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 387 | 388 | # Uninstall Spotify 389 | Get-AppxPackage "SpotifyAB.SpotifyMusic" -AllUsers | Remove-AppxPackage -AllUsers 390 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "SpotifyAB.SpotifyMusic" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 391 | 392 | # Uninstall StickyNotes 393 | Get-AppxPackage "Microsoft.MicrosoftStickyNotes" -AllUsers | Remove-AppxPackage -AllUsers 394 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.MicrosoftStickyNotes" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 395 | 396 | # Uninstall Sway 397 | Get-AppxPackage "Microsoft.Office.Sway" -AllUsers | Remove-AppxPackage -AllUsers 398 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.Office.Sway" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 399 | 400 | # Uninstall TikTok 401 | Get-AppxPackage "*.TikTok" -AllUsers | Remove-AppxPackage -AllUsers 402 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "*.TikTok" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 403 | 404 | # Uninstall Microsoft ToDos 405 | Get-AppxPackage "Microsoft.ToDos" -AllUsers | Remove-AppxPackage -AllUsers 406 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.ToDos" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 407 | 408 | # Uninstall Twitter 409 | Get-AppxPackage "*.Twitter" -AllUsers | Remove-AppxPackage -AllUsers 410 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "*.Twitter" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 411 | 412 | # Uninstall Voice Recorder 413 | Get-AppxPackage "Microsoft.WindowsSoundRecorder" -AllUsers | Remove-AppxPackage -AllUsers 414 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.WindowsSoundRecorder" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 415 | 416 | # Uninstall XBox 417 | Get-AppxPackage "Microsoft.XboxGamingOverlay" -AllUsers | Remove-AppxPackage -AllUsers 418 | Get-AppxPackage "Microsoft.GamingApp" -AllUsers | Remove-AppxPackage -AllUsers 419 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.XboxGamingOverlay" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 420 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.GamingApp" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 421 | 422 | # Uninstall Your Phone 423 | Get-AppxPackage "Microsoft.YourPhone" -AllUsers | Remove-AppxPackage -AllUsers 424 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.YourPhone" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 425 | 426 | # Uninstall Zune Music (Groove) 427 | Get-AppxPackage "Microsoft.ZuneMusic" -AllUsers | Remove-AppxPackage -AllUsers 428 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.ZuneMusic" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 429 | 430 | # Uninstall Zune Video 431 | Get-AppxPackage "Microsoft.ZuneVideo" -AllUsers | Remove-AppxPackage -AllUsers 432 | Get-AppXProvisionedPackage -Online | Where DisplayName -like "Microsoft.ZuneVideo" | Remove-AppxProvisionedPackage -Online -AllUsers | Out-Null 433 | 434 | # Uninstall Windows Media Player 435 | Disable-WindowsOptionalFeature -Online -FeatureName "WindowsMediaPlayer" -NoRestart -WarningAction SilentlyContinue | Out-Null 436 | 437 | # Prevent "Suggested Applications" from returning 438 | #Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows\CloudContent" "DisableWindowsConsumerFeatures" 1 -Force 439 | #Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows\CloudContent" "DisableCloudOptimizedContent" 1 -Force 440 | #Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows\CloudContent" "DisableConsumerAccountStateContent" 1 -Force 441 | 442 | 443 | ############################################################################### 444 | ### Lock Screen # 445 | ############################################################################### 446 | 447 | ## Enable Custom Background on the Login / Lock Screen 448 | ## Background file: C:\someDirectory\someImage.jpg 449 | ## File Size Limit: 256Kb 450 | # Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows\Personalization" "LockScreenImage" "C:\someDirectory\someImage.jpg" 451 | 452 | ############################################################################### 453 | ### Accessibility and Ease of Use # 454 | ############################################################################### 455 | Write-Host "Configuring Accessibility..." -ForegroundColor "Yellow" 456 | 457 | # Turn Off Windows Narrator Hotkey: Enable: 1, Disable: 0 458 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Narrator\NoRoam" "WinEnterLaunchEnabled" 0 459 | 460 | # Disable "Window Snap" Automatic Window Arrangement: Enable: 1, Disable: 0 461 | Set-ItemProperty "HKCU:\Control Panel\Desktop" "WindowArrangementActive" 0 462 | 463 | # Disable automatic fill to space on Window Snap: Enable: 1, Disable: 0 464 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "SnapFill" 0 465 | 466 | # Disable showing what can be snapped next to a window: Enable: 1, Disable: 0 467 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "SnapAssist" 0 468 | 469 | # Disable automatic resize of adjacent windows on snap: Enable: 1, Disable: 0 470 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" "JointResize" 0 471 | 472 | # Disable auto-correct: Enable: 1, Disable: 0 473 | Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\TabletTip\1.7" "EnableAutocorrection" 0 474 | 475 | ############################################################################### 476 | ### Windows Update & Application Updates # 477 | ############################################################################### 478 | Write-Host "Configuring Windows Update..." -ForegroundColor "Yellow" 479 | 480 | # Disable automatic reboot after install: Enable: 1, Disable: 0 481 | Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" "IsExpedited" 0 482 | 483 | # Disable restart required notifications: Enable: 1, Disable: 0 484 | Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" "RestartNotificationsAllowed2" 0 485 | 486 | # Disable updates over metered connections: Enable: 1, Disable: 0 487 | Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" "AllowAutoWindowsUpdateDownloadOverMeteredNetwork" 0 488 | 489 | # Opt-In to Microsoft Update 490 | $MU = New-Object -ComObject Microsoft.Update.ServiceManager -Strict 491 | $MU.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"") | Out-Null 492 | Remove-Variable MU 493 | 494 | ############################################################################### 495 | ### Windows Defender # 496 | ############################################################################### 497 | Write-Host "Configuring Windows Defender..." -ForegroundColor "Yellow" 498 | 499 | # Disable Cloud-Based Protection: Enabled Advanced: 2, Enabled Basic: 1, Disabled: 0 500 | Set-MpPreference -MAPSReporting 0 501 | 502 | # Disable automatic sample submission: Prompt: 0, Auto Send Safe: 1, Never: 2, Auto Send All: 3 503 | Set-MpPreference -SubmitSamplesConsent 2 504 | 505 | ############################################################################### 506 | ### Internet Explorer # 507 | ############################################################################### 508 | #Write-Host "Configuring Internet Explorer..." -ForegroundColor "Yellow" 509 | 510 | # Set home page to `about:blank` for faster loading 511 | #Set-ItemProperty "HKCU:\Software\Microsoft\Internet Explorer\Main" "Start Page" "about:blank" 512 | 513 | # Disable 'Default Browser' check: "yes" or "no" 514 | #Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Internet Explorer\Main" "Check_Associations" "no" 515 | 516 | # Disable Password Caching [Disable Remember Password] 517 | #Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" "DisablePasswordCaching" 1 518 | 519 | 520 | ############################################################################### 521 | ### Disk Cleanup (CleanMgr.exe) # 522 | ############################################################################### 523 | Write-Host "Configuring Disk Cleanup..." -ForegroundColor "Yellow" 524 | 525 | $diskCleanupRegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\" 526 | 527 | # Cleanup Files by Group: 0=Disabled, 2=Enabled 528 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "BranchCache" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 529 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Downloaded Program Files" ) "StateFlags6174" 2 -ErrorAction SilentlyContinue 530 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Internet Cache Files" ) "StateFlags6174" 2 -ErrorAction SilentlyContinue 531 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Offline Pages Files" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 532 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Old ChkDsk Files" ) "StateFlags6174" 2 -ErrorAction SilentlyContinue 533 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Previous Installations" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 534 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Recycle Bin" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 535 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "RetailDemo Offline Content" ) "StateFlags6174" 2 -ErrorAction SilentlyContinue 536 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Service Pack Cleanup" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 537 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Setup Log Files" ) "StateFlags6174" 2 -ErrorAction SilentlyContinue 538 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "System error memory dump files" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 539 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "System error minidump files" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 540 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Temporary Files" ) "StateFlags6174" 2 -ErrorAction SilentlyContinue 541 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Temporary Setup Files" ) "StateFlags6174" 2 -ErrorAction SilentlyContinue 542 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Thumbnail Cache" ) "StateFlags6174" 2 -ErrorAction SilentlyContinue 543 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Update Cleanup" ) "StateFlags6174" 2 -ErrorAction SilentlyContinue 544 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Upgrade Discarded Files" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 545 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "User file versions" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 546 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Windows Defender" ) "StateFlags6174" 2 -ErrorAction SilentlyContinue 547 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Windows Error Reporting Archive Files" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 548 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Windows Error Reporting Queue Files" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 549 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Windows Error Reporting System Archive Files" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 550 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Windows Error Reporting System Queue Files" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 551 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Windows Error Reporting Temp Files" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 552 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Windows ESD installation files" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 553 | Set-ItemProperty $(Join-Path $diskCleanupRegPath "Windows Upgrade Log Files" ) "StateFlags6174" 0 -ErrorAction SilentlyContinue 554 | 555 | Remove-Variable diskCleanupRegPath 556 | 557 | ############################################################################### 558 | ### PowerShell Console # 559 | ############################################################################### 560 | Write-Host "Configuring Console..." -ForegroundColor "Yellow" 561 | 562 | # Make 'Source Code Pro' an available Console font 563 | Set-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont' 000 'Source Code Pro' 564 | 565 | @(` 566 | "HKCU:\Console\%SystemRoot%_System32_bash.exe",` 567 | "HKCU:\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe",` 568 | "HKCU:\Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe",` 569 | "HKCU:\Console\Windows PowerShell (x86)",` 570 | "HKCU:\Console\Windows PowerShell",` 571 | "HKCU:\Console"` 572 | ) | ForEach { 573 | If (!(Test-Path $_)) { 574 | New-Item -path $_ -ItemType Folder | Out-Null 575 | } 576 | 577 | # Dimensions of window, in characters: 8-byte; 4b height, 4b width. Max: 0x7FFF7FFF (32767h x 32767w) 578 | Set-ItemProperty $_ "WindowSize" 0x002D0078 # 45h x 120w 579 | # Dimensions of screen buffer in memory, in characters: 8-byte; 4b height, 4b width. Max: 0x7FFF7FFF (32767h x 32767w) 580 | Set-ItemProperty $_ "ScreenBufferSize" 0x0BB80078 # 3000h x 120w 581 | # Percentage of Character Space for Cursor: 25: Small, 50: Medium, 100: Large 582 | Set-ItemProperty $_ "CursorSize" 100 583 | # Name of display font 584 | Set-ItemProperty $_ "FaceName" "Source Code Pro" 585 | # Font Family: Raster: 0, TrueType: 54 586 | Set-ItemProperty $_ "FontFamily" 54 587 | # Dimensions of font character in pixels, not Points: 8-byte; 4b height, 4b width. 0: Auto 588 | Set-ItemProperty $_ "FontSize" 0x00110000 # 17px height x auto width 589 | # Boldness of font: Raster=(Normal: 0, Bold: 1), TrueType=(100-900, Normal: 400) 590 | Set-ItemProperty $_ "FontWeight" 400 591 | # Number of commands in history buffer 592 | Set-ItemProperty $_ "HistoryBufferSize" 50 593 | # Discard duplicate commands 594 | Set-ItemProperty $_ "HistoryNoDup" 1 595 | # Typing Mode: Overtype: 0, Insert: 1 596 | Set-ItemProperty $_ "InsertMode" 1 597 | # Enable Copy/Paste using Mouse 598 | Set-ItemProperty $_ "QuickEdit" 1 599 | # Background and Foreground Colors for Window: 2-byte; 1b background, 1b foreground; Color: 0-F 600 | Set-ItemProperty $_ "ScreenColors" 0x0F 601 | # Background and Foreground Colors for Popup Window: 2-byte; 1b background, 1b foreground; Color: 0-F 602 | Set-ItemProperty $_ "PopupColors" 0xF0 603 | # Adjust opacity between 30% and 100%: 0x4C to 0xFF -or- 76 to 255 604 | Set-ItemProperty $_ "WindowAlpha" 0xF2 605 | 606 | # The 16 colors in the Console color well (Persisted values are in BGR). 607 | # Theme: Jellybeans 608 | Set-ItemProperty $_ "ColorTable00" $(Convert-ConsoleColor "#151515") # Black (0) 609 | Set-ItemProperty $_ "ColorTable01" $(Convert-ConsoleColor "#8197bf") # DarkBlue (1) 610 | Set-ItemProperty $_ "ColorTable02" $(Convert-ConsoleColor "#437019") # DarkGreen (2) 611 | Set-ItemProperty $_ "ColorTable03" $(Convert-ConsoleColor "#556779") # DarkCyan (3) 612 | Set-ItemProperty $_ "ColorTable04" $(Convert-ConsoleColor "#902020") # DarkRed (4) 613 | Set-ItemProperty $_ "ColorTable05" $(Convert-ConsoleColor "#540063") # DarkMagenta (5) 614 | Set-ItemProperty $_ "ColorTable06" $(Convert-ConsoleColor "#dad085") # DarkYellow (6) 615 | Set-ItemProperty $_ "ColorTable07" $(Convert-ConsoleColor "#888888") # Gray (7) 616 | Set-ItemProperty $_ "ColorTable08" $(Convert-ConsoleColor "#606060") # DarkGray (8) 617 | Set-ItemProperty $_ "ColorTable09" $(Convert-ConsoleColor "#7697d6") # Blue (9) 618 | Set-ItemProperty $_ "ColorTable10" $(Convert-ConsoleColor "#99ad6a") # Green (A) 619 | Set-ItemProperty $_ "ColorTable11" $(Convert-ConsoleColor "#c6b6ee") # Cyan (B) 620 | Set-ItemProperty $_ "ColorTable12" $(Convert-ConsoleColor "#cf6a4c") # Red (C) 621 | Set-ItemProperty $_ "ColorTable13" $(Convert-ConsoleColor "#f0a0c0") # Magenta (D) 622 | Set-ItemProperty $_ "ColorTable14" $(Convert-ConsoleColor "#fad07a") # Yellow (E) 623 | Set-ItemProperty $_ "ColorTable15" $(Convert-ConsoleColor "#e8e8d3") # White (F) 624 | } 625 | 626 | # Customizing PoSh syntax 627 | # Theme: Jellybeans 628 | Set-PSReadlineOption -Colors @{ 629 | "Default" = "#e8e8d3" 630 | "Comment" = "#888888" 631 | "Keyword" = "#8197bf" 632 | "String" = "#99ad6a" 633 | "Operator" = "#c6b6ee" 634 | "Variable" = "#c6b6ee" 635 | "Command" = "#8197bf" 636 | "Parameter" = "#e8e8d3" 637 | "Type" = "#fad07a" 638 | "Number" = "#cf6a4c" 639 | "Member" = "#fad07a" 640 | "Emphasis" = "#f0a0c0" 641 | "Error" = "#902020" 642 | } 643 | 644 | # Remove property overrides from PowerShell and Bash shortcuts 645 | Reset-AllPowerShellShortcuts 646 | Reset-AllBashShortcuts 647 | 648 | ### Package Providers 649 | Write-Host "Installing Package Providers..." -ForegroundColor "Yellow" 650 | Get-PackageProvider NuGet -Force | Out-Null 651 | 652 | 653 | ### Install PowerShell Modules 654 | Write-Host "Installing PowerShell Modules..." -ForegroundColor "Yellow" 655 | Install-Module Posh-Git -Scope CurrentUser -Force 656 | Install-Module PSWindowsUpdate -Scope CurrentUser -Force 657 | 658 | ### Update Modules 659 | Write-Host "Updating Existing Powershell Modules..." -ForegroundColor "Yellow" 660 | Update-Module 661 | 662 | ### Update Help for Modules 663 | Write-Host "Updating Help..." -ForegroundColor "Yellow" 664 | Update-Help -Force -ErrorAction SilentlyContinue 665 | 666 | ### Initiating Windows Update 667 | Write-Host "Initiating Windows Update..." -ForegroundColor "Yellow" 668 | Install-WindowsUpdate -IgnoreUserInput -IgnoreReboot -AcceptAll 669 | 670 | echo "Done. Note that some of these changes require a logout/restart to take effect." 671 | --------------------------------------------------------------------------------