Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chaning an AD attribute with a variable

Status
Not open for further replies.

staro30

IS-IT--Management
Dec 2, 2003
12
GB
Hi,
I have a script that sets a new warning limit in AD - Exchange General - Storage Limits, Selected lines below:

SetUser.Put "mDBStorageQuota", 471040
SetUser.SetInfo

However, I can't get it to work if I want to use a variable rather than an actual integer. Selected code below:

If theType = 1 and mbxsize >= 460000 then
SetMbxQuotasGroup objUserInstance.Fields("adsPath"), mbxsize +10000, mbxsize +15000, mbxsize +25000

Sub SetMbxQuotasGroup (strGroup, Warning, prohibitSend, prohibitSendRx)
Set SetUser = GetObject(strGroup)
SetUser.Put "mDBUseDefaults", False
wscript.echo Warning
SetUser.Put "mDBStorageQuota", Warning
SetUser.Put "mDBOverQuotaLimit", prohibitSend
SetUser.Put "mDBOverHardQuotaLimit", prohibitSendRx
SetUser.SetInfo
Set SetUser = nothing
End Sub

I can see from the wscript.echo that warning contains the correct number. The error I get is (null):Unspecified Error. I've tried to use PutEx but that didn't seem to work. I'm missing something obvious? Hope you can help?

Thanks in advance
Staro
 
Wouldn't GetObject(strGroup) return a group object, not a user object?

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
what about something more like.

Code:
[green]'Get DNS Domain[/green]
set objLDAP = GetObject("LDAP://RootDSE")
strDomain = objLDAP.Get("DefaultNamingContext")

[green]'Get Groups[/green]
set objGroups = GetObject("GC://cn=Users," & strDomain)

[green]'Iterate groups[/green]
for each objGroup in objGroups
    setMbxQuotasGroup objGroup, intWarn, intProhibitSend, intProhibitSendRX
next

sub setMbxQuotasGroup (objGroup, intWarn, intProhibitSend, intProhibitSendRX)
    [green]'Iterate group members[/green]
    for each objUser in objGroup.Members
        objUser.Put "mDBUseDefaults", False
        objUser.Put "mDBStorageQuota", intWarn
        objUser.Put "mDBOverQuotaLimit", intProhibitSend
        objUser.Put "mDBOverHardQuotaLimit", intProhibitSendRX
        objUser.SetInfo
    next
end sub

-Geates

"I hope I can feel and see the change - stop the bleed inside a feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top