Solved

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

Posted on 2013-05-20
4
1,523 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
ID: 39181671
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
ID: 39181706
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
ID: 39182001
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
ID: 39241894
thank you
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

In-place Upgrading Dirsync to Azure AD Connect
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
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 to another domain controller. Log onto the new domain controller with a user account t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

820 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