Questions tagged [get-aduser]

91 questions
2
votes
1 answer

How to make an in-variable change to objects that isn't slow with PSCustomObjects?

I have two tables as pscustomobjects and I tried doing the equivalent of a SQL join to add some properties back into the primary object that I need to read from. The issue is that my code below ran on an object collection for 5 hours with about…
2
votes
1 answer

Using Variables in Powershell Get-ADUser -Filter

Can someone assist me on proper quoting, I need the wild cards beside the varibles for first and last name in a Get-ADUser -Filter search I believe I need to escape the single quotes but can't get a successful return. $LastADname = John $FistADname…
Slippy
  • 51
  • 8
2
votes
1 answer

how to get users whose OU includes the keyword: terminated

In Active Directory, I have "Ex Domain Users" folder including a bunch of folders. There are four folders having "Terminated" keyword that I need to retrieve the users from them. In my powershell script, I do it like below: $users = Get-ADUser…
Eray Balkanli
  • 7,752
  • 11
  • 48
  • 82
1
vote
2 answers

Powershell - query all AD users and get their last login date

I would like to query all AD users and get the following attributes from each user: SamAccountName, UserPrincipalName, LastLogonDate, Enabled, LockedOut, PasswordNeverExpires, CannotChangePassword, whenCreated As the domain has more than one domain…
Rambo2000
  • 13
  • 2
1
vote
1 answer

System.OutOfMemoryException when running Get-Aduser on large data sets

The below script is considerably cut down in terms of the number of user properties being requested and there are approximately 50,000 users to iterate through. My previous approach was to first get a collection of allusers then do a get-aduser on…
Itchydon
  • 2,572
  • 6
  • 19
  • 33
1
vote
1 answer

Combining PowerShell Get-ADUser Filters

Good afternoon, all. I am trying to perform a search in P/S for SamAccountName that contains / starts with "svc_", and does not belong to a group called "disconnected", and write that to an Excel file. What I am trying, at least for the syntax,…
1
vote
2 answers

powershell filter get-aduser

I'm trying to write a tiny script to run through our organization's OUs in AD and return users whose password expires in two weeks or less. One issue I ran into is service accounts in the primary OUs, so I'm trying to exclude accounts whose email…
emcee1342
  • 47
  • 7
1
vote
1 answer

Get AD account expiry date from a list of users names and output the names, usernames and expiry dates of the users to CSV

I have a command which would I would have to define the username of user and this will display the username, name and expiry date of the user: $user = "Username of User" get-aduser $user -property * | select samaccountname, displayname,…
1
vote
1 answer

Get Account Expiration Date of AD account and Manager Name of AD user via PowerShell into CSV

I have a script which is I identify my OU and it searches the OU for AD groups for username, name, email address, AD group name and AD group description and exports this to CSV: $ou = 'distinguishedName of my OU' Get-ADGroup -Filter * -SearchBase…
S.Mahmood
  • 129
  • 11
1
vote
1 answer

Poweshell Set-ADUser ro populate Direct Reports

Hey I have been given a CVS file with the data that I must use to populate some already existing empty users. So far I have been able to populate all the data fields I need such as givenName, description, postalCode etc. However I have been unable…
1
vote
1 answer

Find multiple of the same objects in an Array and do something with these objects

I need a PowerShell-Script that does the following: Get the AD-Groupmember of six different AD-Groups. Show only members who are in more than two of those AD-Groups. Remove these members from those AD-Groups. I could only come up with a Script,…
1
vote
2 answers

List of AD groups and username of users within a specific OU in PowerShell

Was wondering if you could help me with script. This script would search a specific OU (let's say Disabled Users OU) and display all the AD groups all users are part of, the output to a CSV file showing Usernames and AD group names. I have got a…
S.Mahmood
  • 129
  • 11
1
vote
1 answer

Move list of users from one OU to a different OU and disable them at the same time - Powershell

I currently have a script that is able to disable a list of usernames using a text file which has a list of username specified: $users = Get-Content C:\disableusers.txt foreach ($user in $users) { Disable-ADAccount -Identity $user …
S.Mahmood
  • 129
  • 11
1
vote
1 answer

POWERSHELL - Output A Section of the Container/OU of AD-User Account's DistinguishedName

I was voluntold to learn powershell about a week ago, and learned a lot from here. I was unable to find a method that worked for me so now I am posting my first question. I am looking to output under the OU column, not the full DistinguishedName,…
menoskyz
  • 13
  • 2
1
vote
1 answer

I can't make my script for creating users from a csv and emailing the passwords to me work, any ideas?

I'm trying to create a script that will read a CSV full of users to create. It will then create the users and generate them random passwords, it then needs to send me an email with all of the created users and all of their corresponding passwords…
Mark Corrigan
  • 13
  • 1
  • 4
1
2 3 4 5 6 7