BRONZE PARTNER:
BRONZE PARTNER:
Industry News:

| |
| |
 |
 |
 |
 |
 |
| Copying Active Directory Group Membership For Software Distribution – Powershell |
 |
|
|
By: Chris Nackers
Posted On: 1/12/2010
Through SMS/SCCM we use AD groups for software distribution. Something that happens often enough is that we need to copy the groups that one computer is a member of to another computer. Thanks to help from David Crown, I have a nifty powershell script that will do that for me now. If you just run the script straight, it will prompt for the source computer and the destination computer. Otherwise you call the powershell straight with the parameters “Script -src source_comptuer -dest destination_computer”
Also have a simple vbscript to call it for you so you don’t have to open a powershell prompt every time you want to run it.
Details below, and files attached to this post.
You will just need to change the “PATH” in the vbscript file to where the script is stored:
Set objShell = CreateObject("Wscript.Shell") objShell.Run("powershell.exe –noexit &'PATH\copygroupmembership.ps1'")
Here is the powershell script:
Param ($src, $dest)
Add-PSSnapin Quest.ActiveRoles.ADManagement
if ( ($dest -eq $null) -or ($src -eq $null) ) {
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
$src = [Microsoft.VisualBasic.Interaction]::InputBox("Enter the name of the source computer", "Source Computer")
$dest = [Microsoft.VisualBasic.Interaction]::InputBox("Enter the name of the destination computer", "Destinaton Computer")
} $dest = $dest +"$"
$src = $src + "$"
$Groups = get-QADMemberOf $src
$Groups | foreach { if ($_.name -ne "Domain Computers") {
Add-QADGroupMember $_ -Member $dest
}
}
Download Script: Copygroupmembership.zip
|
 |
 |
 |
|
|