As a logoff script, we copy the last logged on user to the managed by attritbute for that computer account. When we rename the computer, we get an error in the script saying that the specified account does not exist. Then the computer takes 10 minutes to shut down the group policy client service.
How can the script be modified to prevent this?
Set objSysInfo = CreateObject("ADSystemInfo")
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
objComputer.Put "managedBy", objSysInfo.Username