Powered by Ed Buford and Coffee

Category: Logs

IIS Default Website connection logs taking a lot of space

While working on an Exchange server last week I notice the 120GB drive was almost full.  I had a guess what the issue was and I was right. The IIS connection logs were taking up 65GB of space.  Now I could have just deleted all the files but someday I would have to come back and do it again. So instead I broke out a great little command to delete these log files every Sunday if the logs are older than 30 days.  I’ve had this command archived for years now so I apologize that I can’t give credit to person who put it together originally – anyway here it is:

Open an command prompt as Administrator and type this in:

at 12:00 /EVERY:Su Forfiles.exe -p C:\InetPub\Logs\LogFiles\W3SVC1 -m *.log -d -30 -c \"Cmd.exe /C del @path\"

Take note of the Path as this can be in different place for you. Also if 30 days isn’t long enough you can change that by changing the –30 to –60 or –90 or whatever you like.

So that created the task but it has yet to run it, unless you have some time to kill to wait until Sunday for this to run you’ll want to kick it off on your own. So open your Task Scheduler and locate the command you just created, right click and choose Run.
If all went well when it completes it will say The operation completed successfully, (0x0)


Multi Mailbox search in Office 365

I’ve was asked to do a Multi-Mailbox search in Office 365 to gather some email when their Journal somehow stopped Journaling.

Now In Exchange I could do this without much thought but doing anything in Office 365 takes me a lot longer as there just don’t seem to be great blogs written on the mundane things I want to do as of yet so I thought I’d add my own.

The Task:
Gather together all the email (undeleted) over the past month and export it to a PST.

  • The user creating this request must have an SMTP address the same as the mailboxes you’re searching (this means the user must be a mailbox user).
  • The user creating this request must be a member of the Discovery Management role group.
  • You need to use the User Principal Name in the of the Discovery Mailbox in order to send the mailbox to create the Powershell Request.

The Solution:

Find your Discovery Mailbox

Get-Mailbox -Resultsize unlimited -Filter {RecipientTypeDetails -eq “DiscoveryMailbox”

Find the User Principal Name for the Mailbox:

Get-Mailbox -Resultsize unlimited -Filter {RecipientTypeDetails -eq “DiscoveryMailbox”} |FL UserPrincipalName

Get Discovery management Group Members:
Get-RoleGroupMember -Identity “Discovery Management”

Add User to Discovery Management
Add-RoleGroupMember -Identity “Discovery Management” -Member USERNAME

Create the search:
New-MailboxSearch “SearchName” -StartDate “1/1/2014” -EndDate “1/22/2014″ -TargetMailbox ” Discovery Mailbox UPN” -MessageTypes Email -IncludeUnsearchableItems -LogLevel Full

Start the Search:
Start-MailboxSearch “SearchName”

Get-MailboxSearch |FL