Solved

Power Shell - Active Directory - updating Managed by tab for multiple groups

Posted on 2013-05-20
4
1,433 Views
Last Modified: 2013-06-12
Hi EE

I have the script below that lets me update the managedby attribute for multiple groups .. Can someone help me modify this or a new script to remove what is in the managedby tab?


import-CSV filename.csv | foreach {get-qadgroup $_.groupname | set-qadgroup -managedby $_.manager
get-qadgroup $_.groupname | Add-QADPermission -Account $_.manager -Rights WriteProperty -Property Member -ApplyTo ThisObjectOnly
}
0
Comment
Question by:MilesLogan
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:Rajitha Chimmani
Comment Utility
Try this if you would like to leave that managedby option blank.

import-CSV filename.csv | foreach {get-qadgroup $_.groupname | set-qadgroup -managedby $null
get-qadgroup $_.groupname | Remove-QADPermission -Account $_.manager -Rights WriteProperty -Property Member -ApplyTo ThisObjectOnly
}
0
 
LVL 2

Author Comment

by:MilesLogan
Comment Utility
Hi Rajitha14

It does remove the option but I get the error below , any ideas ?

Remove-QADPermission : A parameter cannot be found that matches parameter name 'Account'.
At C:\powershell\ManagedByRemove.ps1:2 char:58
+ get-qadgroup $_.groupname | Remove-QADPermission -Account <<<<  $_.manager -Rights WriteProperty -Property Member -Ap
plyTo ThisObjectOnly
    + CategoryInfo          : InvalidArgument: (:) [Remove-QADPermission], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Quest.ActiveRoles.ArsPowerShellSnapIn.Commands.RemovePermissionCm
   dlet
0
 
LVL 16

Accepted Solution

by:
Rajitha Chimmani earned 500 total points
Comment Utility
Try the second command with below syntax.

get-qadgroup $_.groupname | Get-QADPermission -Account $_.manager -Rights WriteProperty -Property Member -ApplyTo ThisObjectOnly | Remove-QADPermission

Note: I have not tried this command myself. Please test with a test group before running it for all groups.
0
 
LVL 2

Author Closing Comment

by:MilesLogan
Comment Utility
thank you
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Resolve DNS query failed errors for Exchange
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now