Sunday, August 30, 2015

Install and Setup Windows 10 for a Developer

I have been writing code on the Microsoft Stack for around 10 years and have set up quite a few developer machines over the years. Starting with Windows XP, Visual Studio 2003, and SQL Server 2000, and on every version of Windows, VS, .NET, and SQL Server since. If there is a quirk with installing dev tools, I've likely run into it. I recently upgraded my primary dev machine to Windows 10, Visual Studio Enterprise 2015, and SQL Server 2014, and decided to capture the steps in this blog so I could point other people to it.

Notice: Obviously, these are my preferences, and may not work for your situation. I am writing this post after running this setup for about a week* (edit: about 6 months now and still good). I will update this post as I continue to work with Windows 10.

Objective

From scratch, set up a developer machine with the following:

1. Windows 10 Pro
2. SQL Server 2014 Developer Edition
3. Visual Studio 2015 Enterprise Edition
4. Other dev tools (git, Sublime Text, Notepad++, etc.)
5. Other dev frameworks (python, node, etc.)
6. Configure Windows 10 for Performance/Developers


Steps

Step 1. Upgrade to Windows 10


It's likely you are already running a previous version of Windows. The upgrade process here is similar to previous versions of Windows. Download the .ISO for Windows 10 and burn it to some external medium (Flash Drive, DVD). Back up everything on the system drive that you want to keep. Power down the computer completely and boot to the external medium with Windows 10 (likely involves pressing F2/F12 during the boot process)

During the installation process, choose the option to format the system drive and install Windows 10 from scratch. Also during the installation process, I usually choose the "custom" install and uncheck all MS Options around "Security" and "Usability". I don't want to send any information to MS about my usage, I don't want Windows Defender turned on, and I don't want Cortana, et al.


Step 2. Configure Windows


After the Windows install completes, I usually configure Windows before installing any dev tools. I was not prompt for a computer name during installation, so the first thing I did was change the name of my computer. (found here: Control Panel\System and Security\System\Advanced System Settings  ...obviously)




You may also notice that you were not prompt for a user name during installation. It appears to now be based off of your MS Account ID. My user name always used to be something like "Aaron", and now it is "hoffm"... It appears you could go through the trouble of setting up another account and specifying the name you'd like to use, but I am just going to deal with being "hoffm" for now.

Configure for Performance
Something else I always do right after a fresh Windows install is configure for performance. I do this by turning off all visual "enhancements" except for font rendering and image thumbnails. Again this can be found in Control Panel\System and Security\System\Advanced System Settings, under the Advanced tab.




Disable Quick Access
The next thing I noticed was the new Quick Access section of the File Explorer. This used to be called something like "Favorites". As I started adding my favorite folders to it (right click on folder and select "Pin to Quick Access"), something odd started happening. Duplicates of folders started to appear, and folders that I did not add myself were also showing up there. I learned that this is a "Usability" feature that is left on, even after you turn off  "Usability" features during the Windows installation. I turned this feature off so it wouldn't constantly monitor my usage. It is found by going to File Explorer\View\Options\Change folder and search options, and unchecking the Quick access options.







Disable Windows Defender
The next thing I always do is disable Windows Defender. I have never run an anti-virus software on any of my dev machines, and, to my knowledge, I have never had a virus.

Hilariously, if you turn off Windows Defender, Windows will now automatically turn it back on for you:


I did find a way to turn it off using a group policy: http://www.download3k.com/articles/How-to-Turn-Off-Windows-Defender-Permanently-in-Windows-10-01350

So we'll see how long that lasts....


Disable Windows Search
And lastly (for now) I turn off Windows Search (or Indexing). I do this because I don't personally need it myself (I remember where I keep things on my own computer) and when it is left on, when the system scan starts up, my computer sounds like it is testing it's Saturn V rocket in preparation for a moon landing...

Now configuring this is a "fun" one. If you turn off Windows Search completely, you lose the nice Windows Key+Search Term functionality to launch applications, but if you don't turn it off enough, you get the rocket engine impersonation described above. I think I have found the happy medium, but we'll see. Essentially, turn off Indexing for all but Start Menu and your User Folder (only the root, none of the subfolders), and disable file content and property indexing at a drive level on any external drives and your system drive. Follow these tutorials for the step by step:

http://www.online-tech-tips.com/computer-tips/simple-ways-to-increase-your-computers-performace-turn-off-indexing-on-your-local-drives/ (do not completely disable Windows Search service)

- https://www.reddit.com/r/Windows10/comments/3fm8bf/were_getting_search_ready/


Disable Hibernation
I also disable hibernation at this time since that is not a feature that I use and the c:\hiberfil.sys takes up a lot of drive space if you have a lot of RAM. More info here

Elevated cmd prompt: `powercfg -h off`


Move Windows Update Cache Locations
The folders used during Windows Update can also grow quickly and take up valuable drive space. I usually link them to an external drive or non-system spindle drive to leave more room on my SSD.

You'll want to turn off the Automatic Update service (more info, even more, more) then create a couple folders on your spindle drive:

d:\c_drive_link\Windows\Installer
d:\c_drive_link\Windows\SoftwareDistribution\Download

Then create the symlinks:

`mklink /j "c:\Windows\Installer" "d:\c_drive_link\Windows\Installer"`
`mklink /j "c:\Windows\SoftwareDistribution\Download" "d:\c_drive_link\Windows\SoftwareDistribution\Download"`



Step 3. Install Dev Tools


After Windows is configured, my next step is to install the "other dev tools". I'm not sure why I do this first, as this list continues to grow the longer I use the dev machine. It just seems right to have some of these in place first before I install SQL Server and Visual Studio.

I install these dev tools by using Chocolatey (instructions on how to install available on that site). It is a great package manager for Windows. While reading about Windows 10, I noticed work is being done to create a "package manager, manager" originally called OneGet, but as far as I can tell, that is not 100% ready yet, so I just used Chocolatey directly (and it doesn't appear there will be any issues with this after/if/when OneGet is ready, as it is just an attempt to standardize package managers, and will just pipe commands to other package managers).

A sample of the "other dev tools" I install:

choco install...

7zip.install
autohotkey.install
git.install
poshgit
nodejs.install
python
googlechrome
firefox
googledrive
dropbox
jing
keepass.install
paint.net
filezilla
regexpixie
notepadplusplus.install
sublimetext2
VisualStudioCode
beyondcompare
teamviewer
crashplan

etc., etc.,

Note: I also configure git at this time and hook up github.com and bitbucket.org, but that is not covered here.

Step 4. Install SQL Server and Visual Studio


And finally, install the Microsoft Stack dev tools. In the past, I would have always gone to "add remove programs" and enabled IIS first, but anymore I use IIS Express and deploy to Azure for testing so no longer enable/turn on this feature. Both of these are pretty straight forward and I use their respective .ISO images downloaded from MSDN. I install SQL Server first, before Visual Studio, and install it as the default instance on the machine. I also install the "Maintenance Tools" during the installation (SQL Server Management Studio).

I then install Visual Studio (as many versions as I'll need) and configure that. The configuration of Visual Studio is a blog post in and of itself, so I'll leave that for another day.


Conclusion


And that's it! Please reach out with any questions that you may have. I will attempt to keep this post up-to-date as I ramp up with Windows 10.

Enjoy!
Aaron

Sunday, August 23, 2015

Import-Module The specified module OneGet was not loaded because no valid module file was found in any module directory

Windows 10, PowerShell, OneGet, PackageManagement, Chocolatey


You may have tried the command:

Import-Module -Name OneGet


And received this message:

Import-Module : The specified module 'OneGet' was not loaded because no valid module file was found in any module directory.


But that's okay, because OneGet was renamed to PackageManagement. So just run this instead:

Import-Module -Name PackageManagement


And really, you probably don't even need to run that command at all.


Sources:
http://www.fixedbyvonnie.com/2014/11/5-minute-setup-using-oneget-chocolatey-windows-10/ 
http://blogs.technet.com/b/packagemanagement/archive/2015/05/05/10-things-about-oneget-that-are-completely-different-than-you-think.aspx