SQL Extract from WSUS Database

Today i had a customer come to me and ask if i could easily gather and provide any data on the versions of BIOS firmware running around their network. After looking in to the best way to achieve this i found that WSUS automatically gathers this information when any client machines check in, however there is no export function within the WSUS console to gather this data into a usable format.

As the data is there we can get to it directly using SQL Management Studio or SQLCMD  (https://www.microsoft.com/en-us/download/details.aspx?id=53591)

Simply install either of the above tools and connect to the SQL Database hosting WSUS this will either be on a SQL server or hosted locally on WID and run the following script

use SUSDB

select distinct ComputerModel,BiosVersion,FullDomainName

from tbComputerTargetDetail td, tbComputerTarget t

where t.target_id = td.target_id

 

Exchange Powershell Mailbox Search

Recently i had to delete some emails from a few user mailboxes. Now i had the choice i could either log in to each mailbox and delete the emails manually or use the Exchange Management Shell. Now i had in excess of 100 mailboxes to process so i chose to use the exchange shell to remove the emails

The syntax for the exchange management shell is as follows:

Search-Mailbox -Identity “username or alias” -SearchQuery ‘Subject:” Your query “‘ -DeleteContent

This is good for one mailbox however this is still Powershell so i can pipe the output of Get-Mailbox as follows to check and delete from every mailbox

Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery ‘Subject:”Your query”‘DeleteContent

As a additional note you can use the following additional syntax to make copies of the mail found by the search

-TargetMailbox “Search Mailbox Name” -TargetFolder “Your Target folder”