?
Solved

Managed By Script Modification

Posted on 2011-09-16
9
Medium Priority
?
709 Views
Last Modified: 2012-05-12
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 
objComputer.SetInfo

Open in new window

0
Comment
Question by:Joseph Moody
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 36551596
can I see your script for renaming computer?
0
 
LVL 22

Author Comment

by:Joseph Moody
ID: 36891644
I was referring to renaming a computer by hand. (for example, if a machine is moved to another location).
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 37417214
Do you rename the account in Active Directory, or on the physical computer?  The only reason I can think that is says the computer doesn't exist, is maybe there's slow replication between your domain controllers, and they don't all have the same renamed computer account.  When you get this problem, connect to each DC and check whether the computer exists, and run this on the system:

Set objSysInfo = CreateObject("ADSystemInfo")
WScript.Echo "LDAP://" & objSysInfo.ComputerName

manually, to see whether the computer is correct.

Rob.
0
Four New Appliances. Same Industry-leading Speeds.

But don't take it from us.  The Firebox M370 is Miercom tested and Miercom approved, outperforming its competitors for stateless and stateful traffic throughput scenarios.  Learn more about the M370, M470, M570 and M670 and find the right solution for your organization today!

 
LVL 13

Accepted Solution

by:
Daz_1234 earned 2000 total points
ID: 37417234
Does it need to be done in the logoff script?  What's wrong with doing it in the logon script?

Daz.
0
 
LVL 22

Author Comment

by:Joseph Moody
ID: 37420220
It occurs when we renamed the account on the physical machine.

I will try it on logon to see. We are normally asked to keep scripts on logoff to help with the logon time.

0
 
LVL 13

Expert Comment

by:Daz_1234
ID: 37422627
I would think that the snippet you posted would be quick so it will not noticeably delay the logon process.

Let's see: Try this for testing:

t = timer
Set objSysInfo = CreateObject("ADSystemInfo") 
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName) 
 
objComputer.Put "managedBy", objSysInfo.Username 
objComputer.SetInfo
Msgbox "took " & timer - t & " seconds."

Open in new window


Daz.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 37423854
Could you have different domain controllers that the PC might connect to that are not in sync?
0
 
LVL 22

Author Closing Comment

by:Joseph Moody
ID: 37446711
Script actually runs fast. Moved to user side
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question