A simple script to read in a text file and hide the users from the GAL..
Naturally, to un-hide then change from TRUE to FALSE on the appropriate line.
S.
'==========================================================================
'
' NAME: HidefromAB.vbs
'
' AUTHOR: Woosie
' DATE : 21-11-2005
'
' COMMENT: Hide a list of users from the GAL. Win 2k3, Ex 2k3.
'
'==========================================================================
If Wscript.Arguments.Count = 0 Then
Wscript.Echo "Error, required argument missing."
WScript.Echo "Include filename to read in users."
Wscript.Quit(1)
End If
Const E_ADS_PROPERTY_NOT_FOUND = &H8000500D
Dim objDSE, objADObject, objClass, i, strPropName,debug
debug=1
sourcef = Wscript.Arguments(0)
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(sourcef, 1, True)
While Not f.AtEndofStream
decodeline=f.ReadLine
newuser=Trim(decodeline)
If debug=1 Then
WScript.Echo ("**Looking for " & newuser)
End If
Set objDSE = GetObject("LDAP://rootDSE")
Set objADObject = GetObject("LDAP://CN=" & newuser & ",ou=Users," & _
objDSE.Get("defaultNamingContext"))
objADObject.GetInfo
objADObject.msExchHideFromAddressLists=True
objADObject.SetInfo
Wend