AhmedAliShaik
asked on
Script for getting AD user information
Team,
I need to get the list of AD users in my domain with a criteria. If the custom attribute 1 and 5 are equal i should get the total number of users count.
get-user -Resultsize unlimited -organizationalunit mydomain.com/Users -filter {((customAttribute6 -like '76*') -and (customAttribute6 -like 'Vehicle*'))}| Measure-Object).Count
When executing the count i am getting the below error:
The term 'customAttribute6' is not recognized as the name of a cmdlet, function
, script file, or operable program. Check the spelling of the name, or if a pat
h was included, verify that the path is correct and try again.
At line:1
+ get-user -resultsize unlimited -OrganizationalUnit mydomain.com/users -Filter
(customAttribute6 <<<< -like '76*')
+ CategoryInfo : ObjectNotFound: (customAttribute1:String) [], Co
mmandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Is there a way i can use custom attribute to retrieve AD users list.
Please help me in executing the cmd.
Thanks in Advance.
I need to get the list of AD users in my domain with a criteria. If the custom attribute 1 and 5 are equal i should get the total number of users count.
get-user -Resultsize unlimited -organizationalunit mydomain.com/Users -filter {((customAttribute6 -like '76*') -and (customAttribute6 -like 'Vehicle*'))}| Measure-Object).Count
When executing the count i am getting the below error:
The term 'customAttribute6' is not recognized as the name of a cmdlet, function
, script file, or operable program. Check the spelling of the name, or if a pat
h was included, verify that the path is correct and try again.
At line:1
+ get-user -resultsize unlimited -OrganizationalUnit mydomain.com/users -Filter
(customAttribute6 <<<< -like '76*')
+ CategoryInfo : ObjectNotFound: (customAttribute1:String) [], Co
mmandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Is there a way i can use custom attribute to retrieve AD users list.
Please help me in executing the cmd.
Thanks in Advance.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Krzysztof ,
I believe Get-ADuser is a Quest cmdlet.
I am able to resolve only get-user even no luck with the command.
Can u revise and give me a windows/Exchange powershell command for the same.
I believe Get-ADuser is a Quest cmdlet.
I am able to resolve only get-user even no luck with the command.
Can u revise and give me a windows/Exchange powershell command for the same.
No, Get-ADUser is a Windows Server 2008R2 PowerShell module for AD. Do you have 2008R2 DC ? If not, which PowerShell version do you use ?
Krzysztof
Krzysztof
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks you.
ASKER
I will try this and post u with updates.