Powershell: Add users to Active Directory Group membership from file, list all NON Expire accounts

by butsch 8. October 2013 17:33

How to add user accounts to a membership of an Active Directory Group.

Users in File: C:\edv\bbuser.csv

Active Directory Group: SG_Blackberry_User_2010

Users: m.butsch and assistant

(First LINE has to be UserName an not a user)

Import-module ActiveDirectory

Import-CSV "C:\edv\bbUser.csv" | % { Add-ADGroupMember -Identity SG_Blackberry_User_2010 -Member $_.UserName }



List all NON Expire accounts in a certian OU:


Import-Module ActiveDirectory

Get-ADUser -SearchScope Subtree -SearchBase "OU=Active,OU=Users_W7,OU=GZF,DC=customer,DC=ch" -Filter  {PasswordNeverExpires -eq $true} -Properties PasswordNeverExpires | Select-Object Name,ObjectClass, UserPrincipalName | Sort-Object Objectclass


Comments are closed

Werbung von Drittfirmen (Nicht Butsch Informatik):

Werbung von Drittfirmen via Google Adsense: