- $properties = @(
- 'BadLogonCount',
- 'badPasswordTime',
- 'badPwdCount',
- 'CanonicalName',
- 'City'
- )
- $users = get-aduser -Identity username -Properties $properties | Select-Object $properties
- Update-DataGridView -DataGridView $datagridview1 -Item $users
Get-Aduser and DGV
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.
Get-Aduser and DGV
I'm trying to pull certain properties of a single user into a DGV, for some reason it's not adding the rows as I see from my searching it should be doing
Re: Get-Aduser and DGV
Sorry, I completely posted the wrong question.
What I need is groupmembership. It's only returning the length
$users = ([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties.memberof -replace '^CN=([^,]+).+$', '$1'
Update-DataGridView -DataGridView $datagridview1 -Item $users
What I need is groupmembership. It's only returning the length
$users = ([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties.memberof -replace '^CN=([^,]+).+$', '$1'
Update-DataGridView -DataGridView $datagridview1 -Item $users
Re: Get-Aduser and DGV
Yes sorry. Please excuse the first post. It's completely wrong
I want to return the groupmembership in a DGV. As you can see from my above post it's only returning the length of the object.
It returns just fine in the ISE
I want to return the groupmembership in a DGV. As you can see from my above post it's only returning the length of the object.
It returns just fine in the ISE
Re: Get-Aduser and DGV
So I want to return the group membership using ADSI into a DGV of the current logged on user. Again, ignore what I originally asked for, that was an error on my behalf.
As you can see it's returning much more than the groupname
This is what I'm getting and the code I'm using
As you can see it's returning much more than the groupname
This is what I'm getting and the code I'm using