Questions tagged [get-aduser]

91 questions
1
vote
1 answer

Pulling Users Emails with PowerShell Script

I have script that will search within an OU and display username, names, AD group and description. $ou = 'distinguishedName of the OU' Get-ADGroup -Filter * -SearchBase $ou -Properties Description | ForEach-Object { foreach($member in…
S.Mahmood
  • 129
  • 11
1
vote
2 answers

Using a variable in Get-ADUser -Filter - PowerShell version 7

When using Visual Studio Code and PSverion 7.2.6 I am no longer able to use a variable in Get-ADUser Filter. Command: Get-ADUser -server $DC -Filter 'sAMAccountName -eq $Input' -Properties $sProperties | Select $sProperties getting this…
1
vote
1 answer

Struggling with PSCustomObject in Compare-Object

Question: Anyone understand why I'm receiving the following error for my title property in my PSCustomObject inside a foreach? I understand what the error is stating, just confused on the 'why' of it. Everything else works, I'm confused why…
Nvlddmkm
  • 31
  • 5
1
vote
1 answer

How do I get "Get-ADGroupMember $group | get-aduser -Properties enabled |select enabled" to return a singe result?

I'm trying to get@{n='Active';e={(Get-ADGroupMember $group | get-aduser -Properties enabled |select enabled).enabled}} to read the samaccount name and return whether the user is enabled or disabled. However the code returns true and false for all…
Warlord213
  • 74
  • 4
1
vote
0 answers

Retrieving an empty attribute from a users account in AD using "Get-ADUser" returns null - but not null?

I'm running into trouble trying to automate a task on our Domain Controllers using a PowerShell script. To make a long story short: I wrote a PowerShell script that retrieves the contents of specific attribute in a users account in Active Directory,…
1
vote
1 answer

PowerShell Active Directory - Can't use array value in filter for Get-ADUser

I have two variables; $test and $accounts[0].upn Both are Strings, both contain the exact same value. When I run: Get-ADUser -Filter "UserPrincipalName -eq '$test'" I get the result I want, however when I run: Get-ADUser -Filter "UserPrincipalName…
1
vote
1 answer

How to filter users based on several criteria in Powershell when using Get-AdUser

I have a question that I was hoping someone could help me with, please. I am trying to get a list of users who meet this criteria using get-adusers: AD field “department” in ('Sales & Admin - All', 'Field - Support','HKLM - All', 'SOD - 1','Home -…
Mike Jones
  • 13
  • 2
1
vote
1 answer

Get-ADUser takes too long when filtering and using IF ELSE statements

A while ago I've posted a question about exporting specific users information from AD to .CSV file (here). Thanks to the help of Santiago Squarzon I managed to make it work and filter just the way I want, except for one small detail - it takes the…
shalan
  • 25
  • 5
1
vote
1 answer

PowerShell Get-ADUser - Using custom AD attibutes as IF condition

What I need to do is to export specific AD users and some of their properties to a CSV file. What I need to have there is some of the default properties like Name, SamAccountName, Enabled and some custom ones: businesscategory, extensionAttribute9…
shalan
  • 25
  • 5
1
vote
1 answer

Manager checking through powershell and Get-ADUser

Below is a section of code I'm struggling to get operation. This is part of a larger script to create AD users. The purpose is to verify if the email address supplied exists and if it does, store it as the $UserManager (Manager) variable to be…
CrowbarTM
  • 23
  • 4
1
vote
1 answer

Powershell Show-Menu script not getting any result from get-ADuser

I'm not getting any result from user's input.. but this message: Get-ADUser : Cannot validate argument on parameter 'Identity' My apologies, I'm just a starter in PS. what am I doing wrong here? I'm trying to get the input from the user in to the…
Toon
  • 29
  • 8
1
vote
1 answer

get a count of users in all OUs and total the count

there was a question posted along time ago about getting a count of users in an OU. the answer to the questions was great (thank you Eric Nord) and I was able to use it to figure out most of what I need but I was hoping someone could help me figure…
NuckinFutz
  • 85
  • 5
  • 18
1
vote
1 answer

PowerShell Find Users from First/Last Name, Error not showing on special Character

I have a list of EN/FR users that have special characters in them. I am trying to get their SamAccountName but the script doesn't work correctly: Remove-Variable * -ErrorAction SilentlyContinue; Remove-Module *;…
FalconRider
  • 75
  • 2
  • 9
1
vote
1 answer

Get-ADUser -Server: add port

I need to connect to port 636 of a server and I'm using the "-Server" option. The official doc says that you can put "Fully qualified directory server name and port", but it doesn't work for me, i tried to put "server:port" and "server port" and…
FID-FB
  • 11
  • 4
1
vote
1 answer

Get AD Group Member Groups and Find Those Group Notes in One Query

I would like to find an AD group user's group's that their in and to find what those different group's notes are. Right now, I'm trying this Get-ADPrincipalGroupMembership "username" | Get-ADUser -Properties info,description Which is giving errors.…
Michael
  • 103
  • 11