i am Roger Li

為何PowerShell 無法辨識Active Directory Cmdlets?


如果在Windows7的電腦初次執行Active Directory模組的PowerShell cmdlets,可能會看以下訊息:

無法辨識 『xxx』 詞彙是否為 Cmdlet、函數、指令檔或可執行程式的名稱。請檢查名稱拼字是否正確,如果包含路徑的話,請確認路徑是否正確,然後再試一次。


原因是你沒有匯入Active Directory系統模組,PowerShell 不明白該指令。要成功匯入模組,請參考以下步驟:

  1. 到」開啟或關閉Windows功能」 把 “Windows PowerShell 的 Active Directory 模組” 設為選擇
  2. 在開始功能表的Windows PowerShell 執行”匯入系統模組

    • 或許你又會看到以下訊息:
      • 檔案無法載入,因為這個系統上已停用指令碼執行。如需詳細資訊,請參閱 “get-help about_signing」。
    • 因為基於安全性問題,Windows PowerShell Script Execution Policy的預設值是」RestrictedNo scripts can be run. Windows PowerShell can be used only in interactive mode.」
執行以下指令可讓修改為」RemoteSigned」:

Set-ExecutionPolicy RemoteSigned

選擇」「之後便完成。


檔案無法載入,因為這個系統上已停用指令碼執行。如需詳細資訊,請參閱 “get-help about_signing」
Set-ExecutionPolicy RemoteSigned
試一試輸入:

Get-ADUser -identity $env:username

應該會顯示出你正在登入的帳號訊息,成功嗎?

Get-ADUser -identity $env:username



Active Directory Cmdlets 一覽
  • Add-ADComputerServiceAccount
  • Add-ADDomainControllerPasswordReplicationPolicy
  • Add-ADFineGrainedPasswordPolicySubject
  • Add-ADGroupMember
  • Add-ADPrincipalGroupMembership
  • Clear-ADAccountExpiration
  • Disable-ADAccount
  • Disable-ADOptionalFeature
  • Enable-ADAccount
  • Enable-ADOptionalFeature
  • Get-ADAccountAuthorizationGroup
  • Get-ADAccountResultantPasswordReplicationPolicy
  • Get-ADComputer
  • Get-ADComputerServiceAccount
  • Get-ADDefaultDomainPasswordPolicy
  • Get-ADDomain
  • Get-ADDomainController
  • Get-ADDomainControllerPasswordReplicationPolicy
  • Get-ADDomainControllerPasswordReplicationPolicyUsage
  • Get-ADFineGrainedPasswordPolicy
  • Get-ADFineGrainedPasswordPolicySubject
  • Get-ADForest
  • Get-ADGroup
  • Get-ADGroupMember
  • Get-ADObject
  • Get-ADOptionalFeature
  • Get-ADOrganizationalUnit
  • Get-ADPrincipalGroupMembership
  • Get-ADRootDSE
  • Get-ADServiceAccount
  • Get-ADUser
  • Get-ADUserResultantPasswordPolicy
  • Install-ADServiceAccount
  • Move-ADDirectoryServer
  • Move-ADDirectoryServerOperationMasterRole
  • Move-ADObject
  • New-ADComputer
  • New-ADFineGrainedPasswordPolicy
  • New-ADGroup
  • New-ADObject
  • New-ADOrganizationalUnit
  • New-ADServiceAccount
  • New-ADUser
  • Remove-ADComputer
  • Remove-ADComputerServiceAccount
  • Remove-ADDomainControllerPasswordReplicationPolicy
  • Remove-ADFineGrainedPasswordPolicy
  • Remove-ADFineGrainedPasswordPolicySubject
  • Remove-ADGroup
  • Remove-ADGroupMember
  • Remove-ADObject
  • Remove-ADOrganizationalUnit
  • Remove-ADPrincipalGroupMembership
  • Remove-ADServiceAccount
  • Remove-ADUser
  • Rename-ADObject
  • Reset-ADServiceAccountPassword
  • Restore-ADObject
  • Search-ADAccount
  • Set-ADAccountControl
  • Set-ADAccountExpiration
  • Set-ADAccountPassword
  • Set-ADComputer
  • Set-ADDefaultDomainPasswordPolicy
  • Set-ADDomain
  • Set-ADDomainMode
  • Set-ADFineGrainedPasswordPolicy
  • Set-ADForest
  • Set-ADForestMode
  • Set-ADGroup
  • Set-ADObject
  • Set-ADOrganizationalUnit
  • Set-ADServiceAccount
  • Set-ADUser
  • Uninstall-ADServiceAccount
  • Unlock-ADAccount


發表回覆

你的電郵地址並不會被公開。 必要欄位標記為 *