Import-module Activedirectory fails “because the timeout limit was exceeded”

The problem of not being able to import the ActiveDirectory module

Another stupidity at the office, last week. I was trying to run powershell with the Active Directory module imported. At first, it took quite some seconds to start the powershell console. Then finally, I got this error:

Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. All rights reserved.

PS C:\Users\Christian> import-module Activedirectory
WARNING: Error initializing default drive: 'The operation returned because the timeout limit was exceeded.'

The ActiveDirectory module was not imported, because it apparently could not reach my domain controller. I thought the error was caused by the ADWS (Active Directory Web Services) not running on my domain controllers. However, they were!
Then I had some moment of clarity: there was a firewall between my client and my domain controllers. Not only a Windows firewall, but also a hardware firewall. I found out when trying to use the Get-Service cmdlet. This command timed out too.

 

Solution to Error initializing default drive: ‘The operation returned because the timeout limit was exceeded.’

To allow traffic of the ActiveDirectory module, allow port 9389 in the firewall. This port is needed for the ADWS service.

As you can see below, the get-service cmdlet started to work too, as I can request the service status of ADWS:

PS C:\Users\Christian> get-service -ComputerName mydomaincontroller -Name adws

Status   Name               DisplayName
------   ----               -----------
Running  adws               Active Directory Web Services

 

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x