Hi Dran, Thank you for sharing easy steps to get the report, this was my first attempt to learn to script, can you please create a video for extracting a single GPO from AD.
This will give you the disabled users list in a csv file Get-ADUser -Filter * -Properties * | where enabled -EQ false | select -Property name,samaccountname,enaled | Export-Csv c:\temp\Disabled_Users.csv -NoTypeInformation
Sure. Try the below. YOu need to keep all your email IDs in a notepad placed in C:\temp\Emails.txt and then run the below. It will take each email IDs and find out the user ID it matches in AD and give you output in csv file. Output will have the belwo informail EmailAddress SamaccountName ------------ -------------- alpha@dran.com Alpha bravo@dran.com Bravo charlie@dran.com Charlie dran@dran.com Dran Here's the script: $MailIDs = Get-Content C:\temp\Emails.txt $UserIDs = Foreach($MailID in $MailIDs) { Get-ADUser -Filter * -Properties * | Where EmailAddress -EQ $MailID | select EmailAddress,SamaccountName } $UserIDs | Export-Csv c:\temp\UserIDs.csv -NoTypeInformation
Nice work. Just one question. How to extract similar details for few selective users. Example i have 10 users but i only want details for user01, user02 and user03.
What about if I need to export the list of users from a security group, I have tried the following Command and the csv was empty Get-ADUser -Filter * -SearchBase "CN=test,OU=Azure Groups,OU=Security Groups,DC=tes,DC=co,DC=uk” -Properties * |`Select-Object Name, UserPrincipalName, Mail |`Export-CSV C:\extract\Email.csv I have added all the users within this security group, thanks
Hi Fouad, It's about your requirements. If you just need members of a particular security group - for example, "Security Group 1", you can run this: Get-ADGroupMember "Security group 1" | select -Property name,SamAccountName | Export-Csv c:\temp\GroupMembers.csv -NoTypeInformation
@@drantrix3950 : you are a star, this has worked, I highly recommend you, Much appreciate that. One last question, if I would like to get the same command but with o365 and retrieve the SamAccountName, have you got any clue within the PowerShell. thanks in advance
@@fouadgbg9725 Thank you so much! that was kind :) I wish I had o365 admin access, but unfortunately I dont. Yet, I found this site as helpful for your query. Please try this one www.sharepointdiary.com/2019/04/get-office-365-group-members-using-powershell.html
@@drantrix3950 regards the office 365 Power Export; I am after exporting users from each individual Assigned Licenses, but again, you did your best, and I have researched all over and no luck, thanks anyway about this reply
Thanks for this video. I've a similar task to do, but not able to write the proper code. I should run the command for multiple ad users using csv file, but unfortunately I end up with errors in powershell. Below is the code which is working for single user, whereas I should achive this for 100+ users... Kindly help me out... "Get-ADUser -Identity olduser -Properties memberof | Select-Object -ExpandProperty memberof | Add-ADGroupMember -Members newuser"
If I understand it correctly, you are trying to get all the security groups from an old user and adding the new users who are taken from the CSV file to the same security groups. Correct me otherwise, I'll give it a try from my side and let you know
Nice 👍 I already know about it...but I have learnt the value of -notypeinformation Thank you!!
nice way to explain, calm way without any panic, this is the style to teach.
Thank you so much ❤️
Hi Dran, Thank you for sharing easy steps to get the report, this was my first attempt to learn to script, can you please create a video for extracting a single GPO from AD.
Noted
Hi it was nice informative, but please try to zoom your screen time to time to see the commands properly
Thanks 👍
Thank you Muzammil! Sure I will do that here after 👍👍🙂
Thank you very much. How to filter out disabled users? Great Video
This will give you the disabled users list in a csv file
Get-ADUser -Filter * -Properties * | where enabled -EQ false | select -Property name,samaccountname,enaled | Export-Csv c:\temp\Disabled_Users.csv -NoTypeInformation
using bulk mail id's need to fetch user id's. Can you help on this ?
Sure. Try the below. YOu need to keep all your email IDs in a notepad placed in C:\temp\Emails.txt and then run the below. It will take each email IDs and find out the user ID it matches in AD and give you output in csv file.
Output will have the belwo informail
EmailAddress SamaccountName
------------ --------------
alpha@dran.com Alpha
bravo@dran.com Bravo
charlie@dran.com Charlie
dran@dran.com Dran
Here's the script:
$MailIDs = Get-Content C:\temp\Emails.txt
$UserIDs = Foreach($MailID in $MailIDs)
{
Get-ADUser -Filter * -Properties * | Where EmailAddress -EQ $MailID | select EmailAddress,SamaccountName
}
$UserIDs | Export-Csv c:\temp\UserIDs.csv -NoTypeInformation
Hello, Dran trix
In real time we need to get the particular users details ( some 50 no. of users). How to do that?
Hi Aziff,
I'm sure it's too long, I've started becoming active in YT now. Let me know if you still help, thanks!
Nice work. Just one question. How to extract similar details for few selective users. Example i have 10 users but i only want details for user01, user02 and user03.
I'm sure it's too long, I've started becoming active in YT now. Let me know if you still help, thanks!
Great Video
Hi Dran how to export ad computers with name and description, site OU and location of all computer objects
Hi, I'm sure it's too long, I've started becoming active in YT now. Let me know if you still help, thanks!
What about if I need to export the list of users from a security group, I have tried the following Command and the csv was empty
Get-ADUser -Filter * -SearchBase "CN=test,OU=Azure Groups,OU=Security Groups,DC=tes,DC=co,DC=uk” -Properties * |`Select-Object Name, UserPrincipalName, Mail |`Export-CSV C:\extract\Email.csv
I have added all the users within this security group, thanks
Hi Fouad,
It's about your requirements. If you just need members of a particular security group - for example, "Security Group 1", you can run this: Get-ADGroupMember "Security group 1" | select -Property name,SamAccountName | Export-Csv c:\temp\GroupMembers.csv -NoTypeInformation
@@drantrix3950 : you are a star, this has worked, I highly recommend you, Much appreciate that.
One last question, if I would like to get the same command but with o365 and retrieve the SamAccountName, have you got any clue within the PowerShell.
thanks in advance
@@fouadgbg9725 Thank you so much! that was kind :) I wish I had o365 admin access, but unfortunately I dont. Yet, I found this site as helpful for your query. Please try this one www.sharepointdiary.com/2019/04/get-office-365-group-members-using-powershell.html
Sorry to bother you again, in regards the Attributes; First Name, Last Name, and email address, I have tried all the possibilities that I can gues and the result is no luck,
PS C:\> Get-ADGroupMember "test" | select -Property LastName, email,SamAccountName
LastName email SamAccountName
-------- ----- --------------
{} {} ftest
PS C:\> Get-ADGroupMember "test" | select -Property fName, email,SamAccountName
fName email SamAccountName
----- ----- --------------
{} {} ftest
PS C:\> Get-ADGroupMember "test" | select -Property fName, emailAddress,SamAccountName
fName emailAddress SamAccountName
----- ------------ --------------
{} {} ftest
PS C:\> Get-ADGroupMember "test" | select -Property fName, mail,SamAccountName
fName mail SamAccountName
----- ---- --------------
{} ftest
@@drantrix3950 regards the office 365 Power Export; I am after exporting users from each individual Assigned Licenses, but again, you did your best, and I have researched all over and no luck, thanks anyway about this reply
Good Video Thankyou very much! How to fetch the all users and assigned licenses(SKUPartNumber) to them? Thanks in advance!
Hi Nadimpalli, I'm not sure how but I'll certainly look into that and find that out for you, thanks!
Thanks for this video. I've a similar task to do, but not able to write the proper code. I should run the command for multiple ad users using csv file, but unfortunately I end up with errors in powershell. Below is the code which is working for single user, whereas I should achive this for 100+ users... Kindly help me out...
"Get-ADUser -Identity olduser -Properties memberof | Select-Object -ExpandProperty memberof | Add-ADGroupMember -Members newuser"
If I understand it correctly, you are trying to get all the security groups from an old user and adding the new users who are taken from the CSV file to the same security groups. Correct me otherwise, I'll give it a try from my side and let you know
@@drantrix3950 You got it correctly but minor missing thing was "from multiple old users to multiple new users"...😀
Gotcha, let me try getting it
Hi Sudheer,
Script is ready, I just replied to you email, pls check and let me know if it works :)
thx
You are most welcome ☺️
what the music in start vidio ?
Hi, it is "arms dealer - Anno domini beats"