KB ID 0001628
I was removing Windows Defender from a lot of servers that had just been deployed, (while doing and AV rollout). So I had a remote session open to all the servers and issued the command on each one, and moved onto the next one. when I went back, about three or four of them had failed with the following error;
PS C:\Users\Administrator> Uninstall-WindowsFeature -Name Windows-Defender
Uninstall-WindowsFeature : The term ‘Uninstall-WindowsFeature’ is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1
+ Uninstall-WindowsFeature -Name Windows-Defender
+ CategoryInfo : ObjectNotFound: (Uninstall-WindowsFeature:String) , CommandNotFoundException
This is strange, the servers were a mix of 2016 and 2019 but were all freshly built, I Googled the error and was told I needed to import the servermanager module, again I thought this was strange, as most of them had worked but OK, then I got this;
PS C:\Users\Administrator> Import-Module servermanager
import-module : The specified module ‘servermanager’ was not loaded because no valid module file was found in any
At line:1 char:1
+ import-module servermanager
+ CategoryInfo : ResourceUnavailable: (servermanager:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
As is usually the case, I’d been a doofus! I assumes as I ‘rattled though each server I’d opened the x64 bit version of PowerShell, but as you can see (from the window headers above) that’s NOT the case!
Sometimes the problem is simply PEBKAC, (Problem Exists Between Keyboard And Chair).
Related Articles, References, Credits, or External Links