Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get-ADUser not recognized

I'm trying to write a script for Powershell that will display the date/time of last login and date/time of last password change for every user and separate the data according to their Organizational Unit within Active Directory.

I'm getting a number of errors, including one that says Get-ADUser isn't even recognized as a command. Any thoughts? Here's my script:

$my=get-credential

get-aduser -filter "name -like * -searchbase 'OU=students,OU=Users,OU=GBNetworkLabs,DC=gbnetworklabs,DC=local'"
-properties * -server gbnetworklabs.local -credential $my | select -property name, lastlogondate, passwordlastset

I've also tried import-module activedirectory but get errors with that too.

Here are some of the parameters I've been given:

Users='OU=Students,OU=Users,OU=GBNetworkLabs,DC=gbnetworklabs,DC=local' Servers='OU=Powershell,OU=VDI,OU=GBNetworkLabs,DC=gbnetworklabs,DC=local'

Any and all help is appreciated! Thank you!

like image 512
ITKev Avatar asked Aug 28 '26 16:08

ITKev


1 Answers

If you need the Active Directory Powershell cmdlets on Windows 10 later verisons they can be installed as follows:

Get-WindowsCapability -Online | Where-Object {$_.Name -like "*ActiveDirectory.DS-LDS*"} | Add-WindowsCapability -Online
like image 116
Scepticalist Avatar answered Aug 30 '26 06:08

Scepticalist



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!