Hi, I am in the process of learning PowerShell which impresses me more and more as days go by. My task is to automatically add currently logged on user to Managed By attribute of computer object, where user is currently logged on, in Active Directory. For sure, this can be done with PS script, triggered via GPO as logon or logoff script. Obviously users have to be given right to read/write Managed By attribute of computer object in AD. I have found .vbs script below but I want strictly to use PowerShell script.
How to solve this task?
Set objSysInfo = CreateObject(“ADSystemInfo”)
On Error Resume Next
Set objComputer = GetObject(“LDAP://” & objSysInfo.ComputerName)
objComputer.Put “managedBy”, objSysInfo.Username