1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Active Directory入門:PowerShell で Active Directory モジュールが読み込めない問題の解決についてまとめてみた

Last updated at Posted at 2025-03-09

はじめに

PowerShell で Active Directory モジュール を使おうとすると、エラーが発生すること があります。

特に Import-Module ActiveDirectory の実行時に、サーバーへ接続できない警告 が出ることがあります。

これは Active Directory への接続に問題がある ことを示しており、いくつかの原因が考えられます。本記事では、エラーの主な原因とその解決方法 について解説します。

起きていたエラー

PowerShell で Import-Module ActiveDirectory を実行すると、以下のエラーが発生することがあります。

WARNING: Error initializing default drive: 'Unable to contact the server. This may be because this server does not
exist, it is currently down, or it does not have the Active Directory Web Services running.'.

このエラーは、Active Directory に接続できないことを示しています。

主な原因(自分調べ)

  1. このサーバーがドメインコントローラーではない(Active Directory がインストールされていない)。
  2. Active Directory Web Services (ADWS) が動作していない。
  3. このサーバーが Active Directory ドメインに参加していない。
  4. ネットワークの問題(ドメインコントローラーに接続できない)。

実際に対応した方法

1. Active Directory Web Services (ADWS) の動作確認

まず、ADWS サービスが動作しているか確認します。

Get-Service ADWS
  • Running → ADWS は正常に動作している
  • Stopped または Not Found → ADWS を開始する必要あり

ADWS が停止している場合、以下を実行:

Start-Service ADWS

または、強制的に再起動:

Restart-Service ADWS

2. サーバーがドメインに参加しているか確認

このサーバーが Active Directory ドメインに参加しているか確認します。

(Get-WmiObject Win32_ComputerSystem).Domain
  • 結果が WORKGROUP の場合 → ドメインに参加していない
  • 結果が ad.honda.com などのドメイン名なら OK

ドメインに参加する場合:

Add-Computer -DomainName "ad.honda.com" -Credential "ad.honda.com\Administrator"
Restart-Computer

3. ドメインコントローラー (DC) に接続できるか確認

ドメインコントローラー (DC) との接続をテストします。

Test-NetConnection -ComputerName "ad.honda.com" -Port 389
  • 成功 (True) → DC に接続可能
  • 失敗 (False) → ファイアウォールやネットワーク設定を確認

LDAP(389)と LDAPS(636)のポートが開いているかも確認:

Test-NetConnection -ComputerName "ad.honda.com" -Port 636

接続できない場合の対策:

  • nslookup ad.honda.com で DNS 解決を確認
  • ping ad.honda.com で名前解決ができるかチェック
  • DNS サーバーの設定をドメインコントローラーに向ける

4. Get-ADUser を明示的にドメインコントローラーを指定して実行

もし Import-Module ActiveDirectory のエラーが続く場合、手動でドメインコントローラーを指定して Get-ADUser を試す。

Get-ADUser -Identity Administrator -Server "dc1.ad.honda.com"

または、DC の IP アドレスを指定:

Get-ADUser -Identity Administrator -Server "192.168.1.10"

まとめ

原因 確認方法 解決策
AD Web Services (ADWS) が動いていない Get-Service ADWS Start-Service ADWS
サーバーがドメインに参加していない (Get-WmiObject Win32_ComputerSystem).Domain Add-Computer -DomainName "ad.honda.com"
ドメインコントローラーに接続できない Test-NetConnection -ComputerName "ad.honda.com" -Port 389 ping ad.honda.com, DNS 設定の確認
明示的にDCを指定すれば動く場合 Get-ADUser -Identity Administrator -Server "dc1.ad.honda.com" -Server オプションを使用

エラーが出る場合は、詳細なメッセージを確認して対処してみてください!

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?