programing

'Get-ADUser' 용어가 cmdlet 이름으로 인식되지 않습니다.

javajsp 2023. 4. 14. 21:13

'Get-ADUser' 용어가 cmdlet 이름으로 인식되지 않습니다.

다음 쿼리를 사용하여 Windows 2008 서버의 사용자를 나열했지만 실패하여 다음 오류가 발생했습니다.

$server='client-pc-1';$pwd= convertto-securestring 'password$' -asplaintext -
force;$cred=new-object  -typename System.Management.Automation.PSCredential -argumentlist 'Administrator',$pwd; invoke-command -computername $server -credential 
$cred -scriptblock {Get-ADUser -Filter (enabled -ne $true)}

예외는 다음과 같습니다.누가 이 문제 푸는 것 좀 도와줄래?

The term 'Get-ADUser' 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.
    + CategoryInfo          : ObjectNotFound: (Get-ADUser:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Active Directory 모듈이 있는 경우 추가

import-module activedirectory

코드 앞에 있습니다.

존재 여부를 확인하려면 다음을 수행하십시오.

get-module -listavailable

Active Directory 모듈은 Windows Server 2008 R2에 기본 탑재되어 있습니다.다음 방법으로 설치합니다.

Import-Module ServerManager
Add-WindowsFeature RSAT-AD-PowerShell

를 사용하려면 , 도메인내에 적어도 1 개의 DC 가 Windows 2008 R2 로 인스톨 되어 Active Directory Web Services(ADWS) 가 인스톨 되어 있을 필요가 있습니다.

Windows Server 2008 의 경우는, 여기를 참조해 주세요.

디폴트로 Activedirectory 모듈이 없는 경우 [여기]에서 추가 방법을 확인하십시오.이것은 모든 머신에서 실행할 수 있으며 Active Directory "domain control" 서버에 액세스할 수 있습니다.

편집

오래된 링크의 문제(이전에 MSDN 블로그가 이유 없이 사라진 적이 있습니다)를 방지하기 위해 기본적으로 Windows 7에서는 리모트 서버 관리 도구(KB958830)를 다운로드하여 설치해야 합니다.인스톨 후에, 다음의 순서를 실행합니다.

  • [컨트롤 패널]를 엽니다.-> [프로그램과 기능]-> [Windows 기능의 온/오프]
  • "리모트 서버 관리 도구"를 찾아 확장합니다.
  • "역할 관리 도구"를 찾아 확장합니다.
  • "AD DS 및 AD LDS 도구"를 찾아 확장합니다.
  • [ Active Directory Module For Windows PowerShell ](Windows PowerShell용 Active Directory 모듈) 옆에 있는 체크박스를 켭니다.
  • [확인]을 클릭하여 Windows가 기능을 설치할 수 있도록 합니다.

Windows Server Edition은 이미 정상이지만 그렇지 않은 경우 Active Directory Management Gateway Service를 다운로드하여 설치해야 합니다.이러한 링크 중 하나가 작동하지 않는 경우에도 KB 문서를 검색하거나 이름을 다운로드하여 찾을 수 있습니다.

get-windowsfeature | where name -like RSAT-AD-PowerShell | Install-WindowsFeature

(BTW,get-windowsfeatureWindows Server에서만 사용할 수 있는 Server Manager 모듈의 일부입니다.)

Windows 2018년 10월 10일 업데이트 이후 특정의 경우activedirectory모듈은 옵션 기능이 아니면 사용할 수 없습니다.RSAT: Active Directory Domain Services and Lightweight Directory Services Tools가 인스톨 되고 있습니다(여기서의 설명과 접지 않는 인스톨 순서).

Windows Powershell을 다시 열고import-module activedirectory정상적으로 동작합니다.

Active Directory 가 표시되지 않는 경우는, AD LS 유저와 컴퓨터 기능을 인스톨 하고 있지 않은 것이 원인입니다.[관리] - [역할 및 기능 추가]를 선택합니다.역할 및 기능 추가 마법사의 기능 탭에서 원격 서버 관리 도구를 선택하고 - 역할 관리 도구 - AD DS 및 DF LDS 도구 선택을 선택합니다.

그 후에, PS Active Directory 패키지가 표시됩니다.

Windows 의 기능의 온/오프를 엽니다.

Active Directory 도메인 서비스가 선택되어 있는지 확인합니다.인스톨 되어 있지 않습니다.여기에 이미지 설명 입력

Windows 11(및 Windows 10)에서는 다음 명령을 powershell에서 실행할 수 있습니다.

Get-WindowsCapability -Online | Where-Object {$_.Name -like "*ActiveDirectory.DS-LDS*"} | Add-WindowsCapability -Online

Windows 10 을 사용하고 있을 때에 이 에러가 발생했을 경우는, RSAT(Remote Server Administration Tools)를 인스톨 하는 것으로, 이 에러 메세지를 해결할 수 있습니다.

https://www.microsoft.com/en-us/download/details.aspx?id=45520

언급URL : https://stackoverflow.com/questions/17548523/the-term-get-aduser-is-not-recognized-as-the-name-of-a-cmdlet