When staff members leave the organisation, we move their account to a sub-OU named “Leavers” under their office’s OU. This triggers their mailbox to be archived in Enterprise Vault.
I thought it was about time to put together a quick scheduled task to ensure that all these “leavers” were automatically disabled and hidden from the Exchange address lists without IT manually having to do it.
I came across this handy and concise example, and modified it to run through a group of OUs while doing what I needed it to do.
Here’s the code. As always, run at your own risk, and test it before putting it into production:
On Error Resume Next
Dim arrLeaverOrgUnits, objOU
arrLeaverOrgUnits = Array("LDAP://OU=Leavers,OU=Sydney,DC=contoso,DC=com",_
For Each strOU in arrLeaverOrgUnits
Set objOU = GetObject(strOU)
' Let's be extra-paranoid here, and make sure we're only working on the leavers OU
' in case someone adds the wrong OU into the array above
If objOU.Name <> "OU=Leavers" Then Exit For
' Loop through each object in the current OU
For Each objObject In objOU
' If the current object is a user
If objObject.class="user" then
'Disable the account
objObject.AccountDisabled = True
' Hide the account from the Exchange address lists
objObject.Put "msExchHideFromAddressLists", True
' Write the information back to the user object in AD
'WScript.Echo objObject.Name & " disabled and hidden from Exchange address lists"
Set objOU = Nothing
I was recently working with a report template where a numbered Heading 1 had a colour and size assigned to the actual number style. This was then causing problems on the table of contents because the number’s style was showing up there too.
The problem is though, it’s impossible to remove the formatting on that number via the UI in Word. By default, the colour is set to “No Color”, but it’s impossible to go back to that setting once a colour has been chosen.
I didn’t want to re-create the entire document as it had macros embedded, and also had a lot of work done already. Luckily, all of this information is stored in XML format, so it’s not too hard to find.
To remove this style information from the number, do the following with a backup of your file.
- Rename the file extension to .zip (I usually just append .zip to the existing filename)
- Copy out the Word folder from within the zip file to somewhere temporary
- Open numbering.xml from the unzipped word folder with something like XML Notepad
- Search for the name of your style. In my case, it was “Heading1” (note the lack of a space between “Heading” and “1”. The style is actually called “Heading 1” in Word:
- Once you find that style, drill down to the w:rPr node. You can see here that a style and colour is defined for the numbering associated with Heading 1
- Remove everything under w:rPr except for w:rFonts->w:hint (I’m sure you could remove this too, but it was there by default for other styles)
- Save the XML file
- Copy the XML file back into the word folder in the zip file
- Rename the file extension back to what it originally was. In my case, it was .docm
- Open the file in Word, and inspect the result. Hopefully, it succeeds for you as it did for me:
Remember: Do this with a backup copy of your file in case you somehow manage to corrupt it.