【问题标题】:Powershell to Set User Account Password to Never ExpirePowershell 将用户帐户密码设置为永不过期
【发布时间】:2020-07-15 00:22:02
【问题描述】:
Set-ADUser -Identity <name> -PasswordNeverExpires $true

Set-ADUser:术语“Set-ADUser”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确并重试。 在行:2 字符:1 + 设置 ADUser -Identity $Name -PasswordNeverExpires $true + ~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Set-ADUser:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

【问题讨论】:

  • 好像PowerShell的activeDirectory模块没有被导入

标签: powershell


【解决方案1】:

您需要导入 ActiveDirectory 模块:

Import-Module ActiveDirectory

检查是否存在:

Get-Module -ListAvailable

如果您没有看到 ActiveDirectory 模块,那是因为您没有安装 AD LDS 用户和计算机功能。转到管理 - 添加角色和功能。在添加角色和功能向导中,在功能选项卡上,选择远程服务器管理工​​具,选择 - 角色管理工具 - 选择 AD DS 和 DF LDS 工具。

windows server 2008 R2默认有ActiveDirectory模块,安装方式如下:

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


【讨论】:

    猜你喜欢
    • 2020-01-30
    • 2010-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-28
    • 1970-01-01
    • 2012-06-17
    相关资源
    最近更新 更多