Powershell script export users have unlimited membership

Danny 0 Reputation points
2025-01-24T11:08:15.3966667+00:00

Hello,

Is it possible to create powershell script of exporting users that have unlimited membership excluding groups like Domain users etc?

Right now I am using this script for temporary group assignment but since I started using this just recently I need export rest of users that have assigned groups for unlimited time

$variable = New-TimeSpan -Days 455

$users = "username" #More than 1 user "xxx","yyy"

$groups = "group_name"

Add-ADGroupMember -Identity $groups -Members $users -MemberTimeToLive $variable

Thanks in advance

Daniel

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,820 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,758 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.