0
votes
Set-ADUser -Identity <name> -PasswordNeverExpires $true

Set-ADUser : The term 'Set-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. At line:2 char:1 + Set-ADUser -Identity $Name -PasswordNeverExpires $true + ~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Set-ADUser:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

1
Sounds like the PowerShell activeDirectory module has not been importedItchydon

1 Answers

0
votes

You need to import the ActiveDirectory module:

Import-Module ActiveDirectory

To check if it exists:

Get-Module -ListAvailable

If you don't see the ActiveDirectory module, then it's because you did not install AD LDS Users and Computer Feature. Go to Manage - Add Roles & Features. Within Add Roles and Features Wizard, on Features tab, select Remote Server Administration Tools, select - Role Admininistration Tools - Select AD DS and DF LDS Tools.

ActiveDirectory module is present by default in windows server 2008 R2, install it in this way:

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