header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Modifying a users group membership properties
Last Post 02 Sep 2008 06:36 PM by Shay. 5 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
SynJunkieUser is Offline
New Member
New Member
Posts:87

--
02 Sep 2008 11:18 AM  

Hi

 

I have recently disabled and moved a bunch of users and now I have to remove them from the groups they are members of (except for a default group).

I have attempted to do this using set-qaduser but I get the the following error:

 

Set-QADUser : A parameter cannot be found that matches parameter name 'memberof'.
At line:1 char:34
+ set-qaduser "Test User" -memberof  <<<< "users, Domain Users"

 

At the moment I am testing the process with the following command;

 

Set-QADUser "Test User" -includeproperties memberof  "Users, Domain Users"

 

But I plan to take the list of users and put hem into a variable and then run ammend the group membership on each one.

$users = (c:\users.txt)

foreach ($user in $users) { Set-QADUser "$user" -includeproperties memberof  "Users, Domain Users" " }

 

Does anyone have any ideas if what I am trying to do is the right way about it?

Many thanks

 

Lee

ShayUser is Offline
Basic Member
Basic Member
Posts:228

--
02 Sep 2008 04:56 PM  
Try with Remove-QADGroupMember


foreach($user in (gc c:\users.txt)){
(Get-QADUser $user).memberOf | Get-QADGroup | where {$_.name -notmatch '^users|domain users$'} | Remove-QADGroupMember -member $user
}


SynJunkieUser is Offline
New Member
New Member
Posts:87

--
02 Sep 2008 06:04 PM  
That's a different way of looking at it and works perfectly Shay, Thank you.

do you know if it it possible to set boolean values using set-qaduser?

I'm now trying to change the values to hide users from the address book.

The command I have tried is: set-qaduser "*bilson*" -IncludedProperties msExchHideFromAddressLists TRUE

I have tried many variations but I cannot get the syntax quite right, and google is not turning up much.

Is it possible to change a vaue with such a simple command?
SynJunkieUser is Offline
New Member
New Member
Posts:87

--
02 Sep 2008 06:16 PM  
Shay

Further to my last post, I have read a post you made to the PowerGui site regarding using the set-mailbox cmdlet. I don't have such a cmdlet and I run Exchange2003 so i'm not sure if that would work.

just a thought.

Lee
SynJunkieUser is Offline
New Member
New Member
Posts:87

--
02 Sep 2008 06:27 PM  
Further to my last post I have managed to solve the issue (with the help of Dmitry’s PowerBlog)

The command I needed was:

Set-QADUser "Test User" -oa @{'msExchHideFromAddressLists'=$True}

Thanks for the help you gave me earlier though.
ShayUser is Offline
Basic Member
Basic Member
Posts:228

--
02 Sep 2008 06:36 PM  

Glad you could resolve it :-)

The set-mailbox cmdlet is a part of exchange 2007 cmdlets. If you don't have Exchange 2007 then you can't use it.

 

 

You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer