Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

Remove the managed by details for all computers in the Domain and save results.

Hi,

Remove the managed by details for all computers in the Domain and save results.
Script which can remove all users that have been specified in the computers managed by tab.Need the results to a file which shows which machine had which user and if removed.

regards
Sharath
0
bsharath
Asked:
bsharath
  • 4
  • 3
  • 2
1 Solution
 
RobSampsonCommented:
Sharath, this script has a section that clears the ManagedBy attribute.....I'll modify it tomorrow to do only that on the computers in the AD....

Regards,

Rob.
0
 
RobSampsonCommented:
0
 
bsharathAuthor Commented:
Ok Rob...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Farhan KaziSystems EngineerCommented:
::  *** SCRIPT START  ***
@ECHO OFF
IF EXIST ManagedBy.ldf DEL /F /Q ManagedBy.ldf
IF EXIST ManagedBy.txt DEL /F /Q ManagedBy.txt
FOR /F "delims=*" %%u IN ('DSQuery * -Filter "(&(objectCategory=computer)(managedBy=*))" -Limit 0 -L') DO (
    ECHO Processing: %%u
      DSQuery * %%u -Attr Name ManagedBy -L >>ManagedBy.txt
      (      ECHO DN: %%~u
            ECHO changetype: modify
            ECHO replace: ManagedBy
            ECHO ManagedBy: %%~u
            ECHO -
            ECHO.
            ECHO DN: %%~u
            ECHO changetype: modify
            ECHO delete: ManagedBy
            ECHO -
            ECHO.)>>ManagedBy.ldf)
IF EXIST ManagedBy.ldf LDIFDE -I -K -F ManagedBy.ldf
IF EXIST ManagedBy.ldf DEL /F /Q ManagedBy.ldf
EXIT /B 0
:: *** SCRIPT END ***
0
 
bsharathAuthor Commented:
Farhan i get this...

Name: DEV-CHEN-MRD100
ManagedBy: CN=Sharath Reddy,OU=Named Accounts,OU=User Accounts,DC=Development,DC=Group,DC=co
Name: msmq
ManagedBy:

So does this mean that this machine had a managed by user and it has been removed.
What id the "Name : msmq"
0
 
Farhan KaziSystems EngineerCommented:
>> So does this mean that this machine had a managed by user and it has been removed.
YES
>> What id the "Name : msmq"
That must be machine name try searching with DSQuery Computer -Name msmq*
0
 
RobSampsonCommented:
Ha, too late....nice one Farhan...
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now