The Term ‘Uninstall-WindowsFeature’ is not Recognized

KB ID 0001628

Problem

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
module directory.
At line:1 char:1
+ import-module servermanager
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (servermanager:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Solution

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

NA

Exchange – Event ID 205 and Event ID 16025

KB ID 0001251 

Problem

At a client this week, they were having a LOT of mail flow problems. Looking at the queue viewer, I could see that all their mail was sat in queues waiting to go into their mails stores. There was a queue for each mail store, and the error on each was “451 4.4.0 DNS query failed Exchange Server error in message queue“. Looking in the Application log it was full of Event ID 205, and 16025 Errors Stating;

Source MSExchange Common

No DNS servers could be retrieved from network adapter {GUID} Check that the computer is connected to a network and that the Get-NetworkConnectionInfo cmdlet returns results.

OR

No DNS servers could be retrieved from network adapter {GUID}. Verify that the computer is connected to a network and that the Get-NetworkConnectionInfo cmdlet returns results.

Solution

First you need to get the ‘Identity” of your actual network card with a Get-NetworkConnectionInfo command, (make sure the correct DNS settings are set for this NIC, i.e. it’s not pointing to a PUBLIC DNS server!)  Once you have it, change the Transport service to use this new ID, with a Set-TransportServer command.

[box]Set-TransportServer {Name-Of-Server} -InternalDNSAdapterGUID {GUID} -ExternalDNSAdapterGUID {GUID}[/box]

Then Restart the Microsoft Exchange Transport Service and the Microsoft Exchange Mailbox Transport Service.

Related Articles, References, Credits, or External Links

NA