Set-ADAccountPassword : Cannot convert 'System.Object[]' to the type 'Microsoft.ActiveDirectory.Management.ADAccount'
required by parameter 'Identity'. Specified method is not supported.
So, as a note, we don’t use backticks to denote code. Instructions for code formatting are listed above the posting text box.
Get-ADUser is returning an array of objects, which is why you’re seeing [object]. The -Identity parameter of Set-ADAccountPassword accepts only a single value, not an array. You can’t, in other words, do what you’re trying - bulk-change passwords. You have to do them one at a time, such as using a ForEach-Object command. The idea being:
Have you had a look to see how many objects are being returned by the Get-ADUser? Judging by the reference in the error to an object array, I think it’s likely that you’ve received more than one, at which point $stu will become an array of (AD account) objects.
If you find thats the case, then you could either try using the pipeline, or a foreach loop to reset the individual account’s passwords.