Should be lots of fun with all of these properties and figuring our how to use -eq instead of -match
'BadLogonCount',
'badPasswordTime',
'badPwdCount',
'CanonicalName',
'City',
'CN',
'createTimeStamp',
'Deleted',
'Department',
'directReports',
'EmailAddress',
'EmployeeNumber',
'employeeType',
'GivenName',
'HomeDirectory',
'HomedirRequired',
'HomeDrive',
'HomePage',
'isDeleted',
'LastBadPasswordAttempt',
'lastLogon',
'location',
'mail',
'mailNickname',
'Manager',
'Modified',
'modifyTimeStamp',
'Name',
'objectSid',
'OfficePhone',
'PasswordExpired',
'PasswordLastSet',
'POBox',
'SID',
'Title',
'TrustedForDelegation',
'TrustedToAuthForDelegation',
'uid',
'UseDESKeyOnly',
'userAccountControl',
'UserPrincipalName',
'uSNChanged',
'uSNCreated',
'whenChanged',
'whenCreated'
Active Directory and DataGridViews
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Active Directory and DataGridViews
You have to use match. It is matching the column contents and not the name. Using eq would create a very large, slow and cumbersome block of code. Just join the list with '|' and use it in the match.
$_.Name -match $list
You can also use an array.
If $list is an array then:
$_.Name -in $list
A comma separated list can be split and rejoined.
An array can be used as "-Properties" and as a filter with "-in".
$_.Name -match $list
You can also use an array.
If $list is an array then:
$_.Name -in $list
A comma separated list can be split and rejoined.
An array can be used as "-Properties" and as a filter with "-in".