Posts

Showing posts from April, 2016

Exchange Server Export Mailboxes of Disabled Users

I was asked the other day to get a list of all the mailboxes connected to users disabled on Active Directory. I fired up Powershell ISE, loaded the Active Directory module and the Exchange snap-ins and started to work on my script. First of all, I had to get a list of all the users in Active Directory that were disabled. This is very easy to implement using the Get-ADUser cmdlet and the Filter parameter. The company's Identity Management System though when disabling a user, it also moves the object to specific OU named "Disabled". To get those users I used the Get-ADUser cmdlet with the SearchBase and filter paramaters: 1 2 $users = Get-ADUser -SearchBase "OU=DISABLED, DC=LAB, DC=LOCAL" -Filter * -Properties * | Where-Object { $_ .enabled -eq $false } Just to make sure that I do not include any active users, I piped the output to a Where-Object cmdlet. Now that I have all the users I had to check if they had a mailbox. Since the

Microsoft SQL Linked Server Test

Today's topic? Microsoft SQL Server Linked Servers! Linked Servers are objects created in Microsoft SQL Server that allow queries to access data on other database servers such as Oracle. There are many reasons why a query that uses a linked server may fail with driver and network being the most common ones. When I need to troubleshoot scenarios like the above, I usually start with testing the linked server connectivity with the query below. 1 2 3 4 5 6 7 8 9 10 declare @ srv nvarchar( 128 ), @ retval int ; set @ srv = ‘ my_linked_server ' ; begin try exec @ retval = sys.sp_testlinkedserver @ srv; end try begin catch set @ retval = sign( @@ error); end catch; if @ retval <> 0 raiserror( ‘ Failed to connect to server ! ’ , 16 , 2 );