Hello Community! I am relatively new to PowerShell scripting and have need for a script to pull members from an AD group, then from those group members determine user accounts which are expiring in the next 30 days. I can run individual commands to gain each of these requirements individually but need to know how to put them together.<\/p>\n
If anyone has any ideas it would be greatly appreciated.<\/p>","upvoteCount":3,"answerCount":4,"datePublished":"2018-07-25T11:44:02.000Z","author":{"@type":"Person","name":"martyshepherd2","url":"https://community.spiceworks.com/u/martyshepherd2"},"acceptedAnswer":{"@type":"Answer","text":"
If you Google you would have found an answer<\/p>\n
Get-ADGroupMember 'xxx'|Get-ADUser -Prop accountexpires|select name,@{N=\"AccountExpires\";E={[DateTime]::FromFileTime($_.AccountExpires)}}\n<\/code><\/pre>","upvoteCount":1,"datePublished":"2018-07-25T12:24:52.000Z","url":"https://community.spiceworks.com/t/ad-account-expiration-of-members-in-a-ad-group/663987/2","author":{"@type":"Person","name":"jitensh","url":"https://community.spiceworks.com/u/jitensh"}},"suggestedAnswer":[{"@type":"Answer","text":"Hello Community! I am relatively new to PowerShell scripting and have need for a script to pull members from an AD group, then from those group members determine user accounts which are expiring in the next 30 days. I can run individual commands to gain each of these requirements individually but need to know how to put them together.<\/p>\n
If anyone has any ideas it would be greatly appreciated.<\/p>","upvoteCount":3,"datePublished":"2018-07-25T11:44:02.000Z","url":"https://community.spiceworks.com/t/ad-account-expiration-of-members-in-a-ad-group/663987/1","author":{"@type":"Person","name":"martyshepherd2","url":"https://community.spiceworks.com/u/martyshepherd2"}},{"@type":"Answer","text":"
What are the individual commands you have? We can help you putting it together.<\/p>\n
If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>