|
|
Doodlescripts.com
| Doodlescripts.com is here as a way to distribute scripts to anyone who needs it. Feel free to submit your scripts and use the available scripts. Simply register for a free account to download and away you go. IF THE SCRIPT YOU FOUND HERE WAS HELPFUL, DONATE $1 TO HELP KEEP THE SITE GOING |
Export Mailbox Information to CSV
Need to export mailbox data to a csv in Exchange 2007?
Get-MailboxStatistics | sort-object totalitemsize -descending | select-object displayname,@{name='Total Size (KB)';expression={$_.totalitemsize.value.ToKB()}},@{name='Total Deleted Item Size (KB)';expression={$_.totaldeleteditemsize.value.ToKB()}},itemcount,storagelimitstatus,database | export-csv E:\tcbscripts\dump.csv
You can add the following to a batch file and put it on a schedule.
C:\WINNT\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "E:\exchsrvr\bin\exshell.psc1" -command "Get-MailboxStatistics | sort-object totalitemsize -descending | select-object displayname,@{name='Total Size (KB)';expression={$_.totalitemsize.value.ToKB()}},@{name='Total Deleted Item Size (KB)';expression={$_.totaldeleteditemsize.value.ToKB()}},itemcount,storagelimitstatus,database | export-csv E:\dump.csv"
Posted by babyrae Thursday, September 18, 2008 (18:03:42)
Search a File by Keyword
This script will let you search a file by keyword and dump each line to an output file. Usually useful for log files where you want to parse a file for a particular keyword, email address or string.
inputParamFile="filename"
logfile="outputFilename"
inputEmail="{search string}"
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set dumpfile = objFSO.CreateTextFile(logfile)
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objTextFile = objFSO.OpenTextFile(inputParamFile, ForReading)
i = 0
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
objDictionary.Add i, strNextLine
i = i + 1
Loop
For Each objItem in objDictionary
if InStr(objDictionary.Item(objItem),inputEmail) then
dumpfile.writeline objDictionary.Item(objItem)
end if
Next
wscript.echo "Done!"
Posted by babyrae Tuesday, September 02, 2008 (13:22:50)
Add Members to a Distribution List in Bulk
Received the following errors when trying to add members to a dl using ldifde.
"specified account name is already a member of the local group" using the following format for the ldf. file
dn: cn=dlname,ou=dls,dc=domain,dc=com
changetype: modify
add: member
member: cn=username,ou=users,dc=domain,dc=com
-
To resolve the issue, I used the following script instead of ldif import. Output.txt should contain the DN for each user on each line.
Posted by babyrae Monday, February 25, 2008 (18:46:22)
|