Chris' Weblog

  Home  |   Contact  |   Syndication    |   Login
  2 Posts | 3 Stories | 1 Comments | 0 Trackbacks

News



Article Categories

Archives

Bloggers

My Sites

Tuesday, June 13, 2006 #

A buddy of mine called and mentioned he needed a script to set individual mailbox quotas on user accounts within a specific Exchange Store. Typically you'd accomplish this by creating a mailbox quota policy at the store level or moving the users to another store that can facilitate the extra mailbox space,...however in this case those options were not available. To make it uglier, each quota setting had to be unique. Having to do this manually would seriously bite, so I wrote this quick vbscript to do just that for him.

Script Mailbox Quotas


Wednesday, May 31, 2006 #

Here is a quick Vbscript that can be used to create roles in ADAM. I suppose you can also use Ldifde but, I get lazy formatting the .LDF file, etc. So here is what this script does:

  1. It calls the input file specified when executing the script. (e.g. cscript CreateADAMRoles.vbs )
  1. It reads the input file, and begins the loop line by line until the end of the file. During each loop, it performs the following ADSI routines.
  1. Connects to LDAP defined within the Global Settings. (e.g. LDAP://localhost:389/cn=roles,dc=contoso,dc=com)
  1. Create a group object, naming it the value defined within the line read. (e.g. cn=Role1). It also sets the groupType value which is a required attribute to be successful.
  1. Upon completion, loop again.

A downloadable version can be obtained here.

Option Explicit

Dim objFSO,objFile, objOU, objGroup, objArgs
Dim strLine, sDomainDN, sInputFile

Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h2

'GLOBAL SETTINGS - Please set these values as per your environment
sDomainDN = "localhost:389/cn=roles,dc=contoso,dc=com"

Set objArgs = WScript.Arguments

If Wscript.Arguments.Count = 0 Then
WScript.Echo ("No input file given on command line." & VbCrLf &_
" Usage: [cscript|wscript] " & WScript.ScriptName & " ")
Wscript.Quit

End If

sInputFile = objArgs(0)

Set objFSO = CreateObject ("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile (sInputFile, 1)

Do Until objFile.AtEndOfStream
strLine = objFile.Readline

Set objOU = GetObject("LDAP://" & sDomainDN)
Set objGroup = objOU.Create("Group", "CN=" & strLine)

WScript.Echo "Creating Group: " & strLine
objGroup.Put "groupType", "-2147483646"

objGroup.SetInfo
Loop

objFile.Close