Powershell script using Quest AD Plugins, adding a user to a specific security or distribution group.
# script to modify membership of AD groups
# Powershell script to change a users domain password, requires ps snapin from
# http://www.quest.com/activeroles-server/arms.aspx
# then register the snapin with Register the snap-in. (Key point)
# add-PSSnapin quest.activeroles.admanagement
# bhart
$domainstr = ",dc=domain1,dc=org"
$domainnb = "domain" ## domain netbios name
$domain = "FQDN"
$ou = "ou=People, dc=domain,dc=org"
$pw = Read-Host "Please enter domain admin password"
connect-QADService -service 'localhost' -proxy -ConnectionAccount 'difc\administrator' -ConnectionPassword $pw
$groupname = Read-Host "Please enter group name or partial"
$username = Read-Host "Please enter username to add"
Get-QADGroup $groupname
$groupname2 =Read-Host "Please enter the full group name"
Add-QADGroupMember $groupname2 -Member $username
No comments:
Post a Comment