header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Changing Password For OU
Last Post 15 Dec 2009 09:08 AM by James. 4 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
JamesUser is Offline
Basic Member
Basic Member
Posts:374
Avatar

--
11 Dec 2009 01:44 AM
    Hello,

    I am trying to get a script together for resetting passwords for all the users in a specific OU however I want to exclude 4 accounts from the process as they have static accounts. Also the password would have to be set to change on next logon again making sure the 4 accounts are excluded.

    Does anyone know how to do this?

    My Attempt is:

    <BR><BR>$OU = "OU=users,OU=freshfield,OU=schools,DC=stockport,DC=sch,DC=UK" Get-QADUser -searchRoot $OU | where{-not "admin" -or "cog" -or "technical" -or "headteacher"} set-mailbox -identity $_.samAccountName -password "password"<BR><BR>


    Basically the where clause is looking for some generic accounts with headteacher, cog, technical, and admin in them the rest of the passwords can be changed to whatever password is set.

    Many Thanks

    James
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    12 Dec 2009 11:53 PM
    This will set the SAME password for all $OU members and require them to reset their password at next logon,
    except for those that their samAccountName is present in $exclude.

    $exclude = "admin" , "cog" , "technical" , "headteacher"
    Get-QADUser -SearchScope $OU | Where-Object { $exclude -notcontains $_.samAccountName } | Set-QADUser -UserMustChangePassword $true -UserPassword 'P@ssw0rd'





    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    JamesUser is Offline
    Basic Member
    Basic Member
    Posts:374
    Avatar

    --
    14 Dec 2009 01:44 AM
    So basically so I understant correctly if any part of there same account name is equal to anything in exclude then it will just ignore it?

    Many Thanks

    James
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    14 Dec 2009 06:23 AM
    Correct.

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    JamesUser is Offline
    Basic Member
    Basic Member
    Posts:374
    Avatar

    --
    15 Dec 2009 09:08 AM
    Thank you for the clarrification! :)

    James
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer