This script will find the members of a group, enumerate their sAMAccountName into an array and the apply a FSRM storage template to each member.

 

I hope to develop the script to have a group called 100 MB Limit and add groups to it ... so I can manage all my quotas by group and have a big daddy script to do them all ;o)

PowerShell
Edit|Remove
$group = [adsi]"LDAP://cn=ICT,ou=Business,ou=Groups,ou=MainSite,ou=MyUsers,dc=mycompany,dc=co,dc=uk" 
$groupSearcher = New-Object DirectoryServices.DirectorySearcher($group) 
$groupSearcher.PageSize = 1000 
$results = $groupSearcher.FindOne() 
#$results.properties.item("member")

$members = $results.properties.item("member")

foreach ($member in $members) {

	$user = [adsi]"LDAP://$($member)" 
	$userSearcher = New-Object DirectoryServices.DirectorySearcher($user) 
	$userSearcher.PageSize = 1 
	$results = $userSearcher.FindOne() 
	$sAMAccountNames = $sAMAccountNames + $results.properties.item("sAMAccountName")
}

foreach ($sAMAccountName in $sAMAccountNames) {
	Write-Host "Quotas being modified for $($sAMAccountName)"
	dirquota quota Modify /Path:c:\Data\Users\Staff\$($sAMAccountName) /SourceTemplate:"100 MB Limit"
}