Thursday, January 23, 2014

Search and Delete specific message from all mailboxes Exchange 2010

Search and Delete specific message from all mailboxes Exchange 2010

First user account that you will perform this function must have specific rights

Execute the command below ( I am going to use administrator account)

Add-RoleGroupMember "Discovery Management" -Member "administrator"

Execute the command below ( I am going to use administrator account)

New-Managementroleassignment -Role "Mailbox Import Export" -User "Administrator"




After Adding Permission you should close and reopen EMS console


Search and Delete

Get-mailbox | search-mailbox -searchquery "Subject:'MustbeDeleted'" -DeleteContent

Command is going to request confirmation for operate type= A [Yes to All]

Note: Target mailbox you indicated below will not be searched for keywords


If you get error like below;

a positional parameter cannot be found that accepts argument

Close and reopen EMS console.

If you get error like below;

The property keyword isn’t supported

Remove RE: or FW: from subject part in the command than try command again.


Subject must be indicated completely and properly in order command to operate.


Other Search Parameters

Ex.       attachment:report.pptx
Ex.       cc:paul shen or cc:pauls or cc:pauls@contoso.com
Ex.       from:bharat suneja or from:bsuneja or from:bsuneja@contoso.com
Ex.       sent:yesterday

Multiple Parameters Example

[PS] C:\Windows\system32>Get-mailbox | search-mailbox -searchquery "Subject:'mustbedeleted' AND Received: > $('07/08/2014 10:00:00') AND Received: < $('07/08/2014 11:00:00')" -DeleteContent


Get-mailbox | search-mailbox -searchquery 'from:"no-reply@sharepoint.com"' -DeleteContent


    Mailbox Search Role   This role allows you to search for messages across multiple mailboxes in your organization. Administrators aren’t assigned this role by default. To search multiple mailboxes, add yourself as a member of the Discovery Management role group.
   Mailbox Import Export Role   This role allows you to delete messages from a user’s mailbox. This role isn’t assigned to administrators by default. To delete messages from users’ mailboxes, add the Mailbox Import Export role to the Organisation Management role group.




Automated Script

http://gallery.technet.microsoft.com/Simplying-Discovery-Search-1fbfde94











Read more...

Exchange 2010 Backup Status Check Commands.

Get-MailboxDatabase -Status | fl Name,Server,LastF*Backup,LastI*Backup, LastD*Backup
Read more...

Tuesday, January 21, 2014

Block specific SSID on Windows OS

In order to block SSID

netsh wlan add filter permission=block ssid=ssidname networktype=infrastructure

OR

netsh wlan add filter permission=block ssid=ssidname networktype=adhoc



In order to allow SSID

netsh wlan delete filter permission=block ssid=ssidname networktype=infrastructure

OR

 netsh wlan delete filter permission=block ssid=ssidname networktype=adhoc
Read more...

Friday, January 10, 2014

Removing Sysadmin Role from sa user

It is not possible to remove sysadmin role rights from sa user neither by using Management Studio nor by SPs.

I 've found an alternative way to accomplish this process.

1) Rename existing sa username by using the command below;

ALTER LOGIN sa WITH NAME = newusername

2) Create a new user account named sa

3) Assign appropriate Server Roles and Configure User Database mapping.


Read more...
 
span.fullpost {display:none;}