'How to get the date of when the user was added to group?
I have automating our change procedure and checking groups for users. If they are already added to the group, the script will detect this and not add the user to group. However, we want to log when that user was added to the group before the change procedure so we can figure out why this happened.
Is there a way I can query the list of members for a group for the date the member was added?
Solution 1:[1]
This script is awesome
https://gallery.technet.microsoft.com/scriptcenter/Find-the-time-a-user-was-a0bfc0cf
just run the script and look for the group details
Get-ADGroupMemberDate -Group 'Domain Admins'
Solution 2:[2]
Event logs might save you. 4728/4729 > A member was added/removed to/from a security-enabled global group 4732/4733 > A member was added/removed to/from a security-enabled local group 4756/4757 > A member was added/removed to/from a security-enabled universal group 4751/4752 > A member was added/removed to/from a security-disabled global group (distribution list) 4746/4747 > A member was added/removed to/from a security-disabled local group (distribution list) 4761/4762 > A member was added/removed to/from a security-disabled universal group (distribution list)
Get-EventLog -logname security | Where-Object {($_.eventid -eq 4732) -or ($_.eventid -eq 4733 ) -or ($_.eventid -eq 4746)} | select EventID,MachineName,EntryType,Message,InstanceId,TimeGenerated,Timecreated,UserName | fl | export-csv -path C:\logs.csv
Solution 3:[3]
There are 3 problems I have for you:
The channel doesn’t exist (self explanatory)
You are not caching the channel
//To cache the channel do this:
await message.guild.channels.fetch();
//…find code, etc
- Your bot doesn’t have access to the channel. If you don’t see the bot in the channel's members list, then the bot clearly doesn’t have access. Make sure to give the bot view channel permissions in the channel.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DisplayName |
| Solution 2 | DisplayName |
| Solution 3 |
