#Copy Members from Group 1 to Group 2 function Get-ScriptDirectory { $Invocation = (Get-Variable MyInvocation -Scope 1).Value Split-Path $Invocation.MyCommand.Path } $ScriptPath = Get-ScriptDirectory $group1 = Read-Host "Enter GroupName to copy from" $group2 = Read-Host "Enter GroupName to copy to" $membersInGroup1 = Get-ADGroupMember $group1 $membersInGroup2 = Get-ADGroupMember $group2 $membersInGroup1 | % {Add-ADGroupMember -Identity $group2 -Member $_ $LogDate = (Get-Date).ToString("yyyy.MM.dd") $LogTime = (Get-Date).ToLongTimeString() $LogPath = Test-Path "$ScriptPath\Logging" if ($LogPath -eq $True) {"----------------------------------------------------" | Out-File -FilePath "$ScriptPath\Logging\Log_$LogDate.log" -Append} else {New-Item -Path "$ScriptPath\Logging" -ItemType directory} "$LogDate $LogTime Done! Account $_ added to Group $group2 or allready present.." | Out-File -FilePath "$ScriptPath\Logging\Log_$LogDate.log" -Append}