I have a bunch of scripts I use when I'm building a lab to install "stuff" (that's the Technical Term we IT Professionals use) that I need to manage and work with a virtual machine. Now, when I build from a SysPrep'd image, that's not an issue, but if I have to build from an ISO, I want to automate the process as much as possible. So I have a couple of Setup scripts I run that install gVim, HyperSnap (my screen capture tool), and various other things.
As I was building a new lab this week, I realized that those scripts were all designed to deal with full GUI installations, and had no provisions for not installing applications that make no sense and can't work when there's only a Server Core installation. So, time to find out how I can tell if I'm running as Server Core, obviously. A bit of poking around, and I came up with the following:
$regKey = "hklm:/software/microsoft/windows nt/currentversion" $Core = (Get-ItemProperty $regKey).InstallationType -eq "Server Core"
(You could do that as a single line, obviously, but I broke it up to make it easier to see on the page. )
The result is stored as a Boolean value in $Core, and I can now branch my installation decisions based on the value of $Core. (Note there ARE other ways to determine whether you're running on Server Core, but they appear to all be programmatic ones not well suited to the avowedly non-programmer IT system administrator types like me. )
There are some older applications that require earlier versions of .NET than the version included and enabled by default on Windows 8 and Windows 8.1. Normally you can enable the .NET Framework 3.5 (which includes .NET 2.0 and .NET 3.0) as a Windows Feature. (Control Panel, Programs and Features, Turn Windows Features on or off.) But in some environments, especially those using SBS and WSUS, you may get an error message:
0x800f0906: “Windows couldn't connect to the Internet to download necessary files. Make sure that you're connected to the Internet, and click Retry to try again.”
This, of course, is totally bogus because the computer IS connected to the Internet, but save yourself some grief and do it from the command line in the first place. The files you need are part of the DVD (or USB stick or whatever) that you used to install Windows. Just insert that media and from an elevated command or PowerShell prompt type:
PSH> DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:E:\Sources\SxS
Deployment Image Servicing and Management tool
Image Version: 6.3.9600.16384
The operation completed successfully.
Where the E: drive in E:\Sources\SxS is replaced by the drive letter of the DVD, USB or other media source or your Windows distribution media. Or, the pure PowerShell way:
PSH> Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -All -LimitAccess -Source "E:\Sources\SxS"
Now, whatever application it is that needs this older version of the .NET Framework will be happy. (Zune 4.8, in my case.)
Updated: 13 November 2013: Added PSH equivalent.
: 2 June, 2014: Fixed curly quotes
: 13 October, 2014: Confirmed, the same command works in Windows 10 Preview
You can install Office 2010 in an RD Session Host (ie, Terminal Server), if you have a volume license version. (If you're using MSDN versions for testing, there's a special key for use in an RD Session Host environment see: http://support.microsoft.com/kb/983443.)
Great, and you can go ahead and use all the various features of Office. Except OneNote, which fails with an error message telling you to install the Desktop Experience Feature since you're on Windows Server. Well, that's great, and if you're on Server 2008 R2, that's the solution. BUT, if you're running on Windows Server 2012, there is no longer a Desktop Experience Feature. It's GONE. However, what OneNote is looking for is "Ink and Handwriting Services ".
To solve the problem, and install the necessary feature, run:
PS C:\> Add-WindowsFeature InkAndHandwritingServices
This will automatically load the ServerManager module (isn't PowerShell v3 cool?!) and add the necessary feature. This WILL need a reboot, so be prepared.