Questions tagged [get-aduser]
91 questions
1
vote
2 answers
How do I run commands in a Powershell script?
I am very new to Powershell, Started today actually, and I need some help with getting a command to display output. The command works when run from powershell but when I try to run from my script I pasted it seems to fail. I've even changed the…

Ian Oberdorf
- 21
- 2
1
vote
3 answers
Script to get AD logon name from a list of DisplayName
I'm trying to get a list of AD user's logon names from a list of display names using this script.
Import-Csv 'C:\temp\displaynames.csv'
ForEach-Object {
$name = $_.displayname
Get-ADUser -Filter * -Properties DisplayName |…

Matt
- 413
- 1
- 5
- 12
1
vote
1 answer
Output CSV file and net user command not aligned with PS command
Below I have a PS command to get some useful user info. I want also have the input from a csv file with PC names. How can I give everything the same format?
The colon after PC name is not the same as I've got from the output from get-aduser. Can…

Toon
- 29
- 8
1
vote
1 answer
How to clean up results of a Powershell script
PowerShell beginner here. Enjoying it so far!
I've got a list of users that I need to compare against AD. I've created a script to search for Get-ADUser Name and EmailAddress for each user, using an array of Divisions as filter.
If AD user is found,…

randomuser
- 13
- 3
1
vote
1 answer
Email formatting with powershell using send-mailmessage
Objective: search for all disabled users who have something in the ipPhone attribute, email the results to email address.
Issue: when I receive the email, the data is not separated by user account or in a table
Not sure how to correct…

Milgard Sharepoint
- 13
- 3
1
vote
1 answer
Having some trouble filtering Get-ADUser using whenCreated powershell command
I can use some help structing/nesting the below powershell code to get the desired outcome.
When I use the command:
Get-ADGroupMember -Identity $groupname |
Get-ADUser -Properties * -Erroraction Ignore |
select…

Justin V
- 27
- 5
1
vote
1 answer
PowerShell Get-ADUser, output to JSON with formatted DateTime
I'll say first that I'm not very experienced with PowerShell, so many things are not obvious to me.
I've got the following command:
$JSON = Get-ADUser -Filter "SAMAccountName -eq 'jdray'" -Properties SAMAccountName,
Name,
DisplayName,
…

J.D. Ray
- 697
- 1
- 8
- 22
1
vote
1 answer
Azure AD user's status
How can I check status ( active or account lock or inactive status) of a user in Azure AD?
I am not sure if there any way to verify users status. Can Someone please help.

Govind Sharma - MSFT
- 81
- 10
0
votes
1 answer
Powershell to read a list Usernames to show the AD group membership of each user and to output this to CSV file
I have a command that will display the AD group membership of a user:
Get-ADPrincipalGroupMembership username | select name
But I have to type each username for every user.
I was wondering if someone could assist me in script where I would provide…

S.Mahmood
- 129
- 11
0
votes
1 answer
Powershell - I try to list computers that have a specific string in their description, but I'm unable to create a proper command
In my understanding I made a code that first lists computers with all their properties, then selects only the description property and after that it filters the computers whether they contain the specified string.
Get-ADComputer -Properties * |…
0
votes
1 answer
Removing the header in Powershell Export-Csv output for Select-Object
I'm outputting a list of members from an AD group to a csv file. Right now it's outputting with the header 'name'. I currently want to have the output without the header.
This is my code:
$groupNames = @('Group1', 'Group2', 'Group3',…

noobCoder
- 89
- 7
0
votes
1 answer
powershell import csv data x,y,z to command not working
powershell import csv data x,y,z to command not working
i call function Set-LogonHours via import-csv
Import-Csv .\data.csv | % {
Set-LogonHours -Identity $_.user -TimeIn24Format @($_.time) -Monday -Tuesday -Wednesday -Thursday…

December Pandora
- 3
- 2
0
votes
1 answer
Problems with Get-ADUser -Filter
I want to know how many Users whose ending are two numbers there are where the Attribute "UserParameters" is null. This is my command so far:
$var1 = Get-ADUser -Filter {SamAccountName -like "*[0-9][0-9]"} -SearchBase…

cosmo_
- 11
- 5
0
votes
0 answers
ProxyAddresses - filter on Get-ADUser not working with variable
I want to find users having in ProxyAddresses a specyfic mail address.
I would like to make this two lines working
$mail = "person@domain.com"
Get-ADUser -Filter {proxyaddresses -like "*$mail*"} - not working
like this:
Get-ADUser -Filter…

Adam
- 5
- 2
0
votes
1 answer
Define AD Account Expiry Date Time and AD groups for Bulk AD Account Creation via CSV file
I have a script which automates bulk AD account creations.
The script works fine but when I try to define account expiry date and time for each user (-AccountExpirationDate) it fails.
The script is as follows:
# Store the data from NewUsersFinal.csv…

S.Mahmood
- 129
- 11