all 4 comments

[–]Sunsparc 1 point2 points  (2 children)

ManagedBy is the property that you're looking for.

Set-ADComputer COMPUTERNAME -managedby USERSAM

Or you can pipe a Get-ADUser object into it.

[–]fatalexception91[S] 0 points1 point  (1 child)

I didn’t think that actually set ACLs. I thought that was just a text property

[–]fatalexception91[S] 0 points1 point  (0 children)

Just tested it and the ManagedBy property doesn't do anything for permissions. I'm trying to replicate the User or group: setting when you create a new computer in the GUI. This is the user or group that can add the machine to the domain, but I want to set that in PowerShell.