Powershell kicks off, but says "The specified module ‘ServerManager’ was not loaded because no valid module file was found in any module directory’.
When I log in to the server and run the script, it works fine. I’m assuming it is because I’m running as System, and not a specific user. I’ve tried to specify the full path of the module directory but that didn’t help.
this may be because the powershell.exe is being launched from a 32-bit process and file-redirection kicks in to run the 32-bit powershell in SysWOW64 instead of the 64-bit one which will have the modules.
The registry can also be referenced. Here is an example that installs some roles. Notice the x64 registry reference. Note that we have seen some features and roles need to be installed on separate lines of a powershell overwise the install will fail. For example, installing Hyper-V and WDS simultaneously on the same line fails, but works if they are on different lines.
parameter “PowerShellexe”="{value “Path” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of x64 registry}"
I know this isn’t via powershell… however consider checking into my Features project http://bigfix.me/features
I believe powershell just adds a layer of complication for something very simple. My Features content uses the dism.exe tool to detect features and a special database/fixlet generator to create install and uninstall fixlets for each feature detected. I’ve used the dism.exe tool and scanned many different versions of windows vista, 7, 8, and the various servers to give you a good complete list of available features to generate fixlets for.