S
S
simakmak2018-03-12 14:15:18
PowerShell
simakmak, 2018-03-12 14:15:18

How to export specific users from a domain using Powershell?

Good afternoon guys!
There was such task, to export users from software UserGate. Find them in the local domain by last name, export and transfer to another domain.
Using python, I parsed the xml file usergate. Got surnames, now you need to find these surnames in the domain and import them into cvs. Unfortunately, I don't know powershell at all. That's why I'm asking for a little advice.

$DB = cat .\user.txt
foreach ($i in $DB)
{
$Users = Get-ADUser -Filter {Surname -eq $i} -Properties *

}

Thus, I was able to find users, but I don’t know how to correctly add everything in order to export each user to csv.
I ask for your help))

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
azarij, 2018-03-12
@simakmak

$DB = cat .\user.txt
foreach ($i in $DB)
{
Get-ADUser -Filter {Surname -eq $i} -Properties * | export-csv c:\test\csvfile.csv -append -notypeinformation
}
works?

S
simakmak, 2018-03-12
@simakmak

notype information

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question