Thursday, January 11, 2018

Microsoft SQL Database that was in Recovery Pending mode

Microsoft SQL Database that was in Recovery Pending mode

Fundamentally , this error is closely correlated to that Forcibly deletion process  of File stream file which I do think no other solution except waiting to finish recovery mode and either wise it will end with :

The most optimistic   probability  that it will end up with Online mode …So it will be fine and no need for any further action  ( Just you have to wait for a longer time if log file was such huge)..
The most pessimistic probability that it will end up with suspect  mode  ..SO it will be need to run the below process of DB Repair  but bear in mind that data loss might be there;
Stop SQL Server and remove transaction log file of this DB then restart again where DB should go with suspect mode ….If so you can run the below query

ALTER DATABASE [DB_Name] SET  SINGLE_USER WITH NO_WAIT

ALTER DATABASE [DB_Name] SET EMERGENCY;

DBCC checkdb ([DB_Name], REPAIR_ALLOW_DATA_LOSS  )

ALTER DATABASE [DB_Name] SET online;

ALTER DATABASE [DB_Name] SET  Multi_USER WITH NO_WAIT

Thursday, October 19, 2017

Force Update Exchange Address book


Below commands will update global address list and offline address book.
It will then inform the CAS server about the change.

Get-GlobalAddressList | Update-GlobalAddressList

Get-OfflineAddressBook | Update-OfflineAddressBook

Get-ClientAccessServer | Update-FileDistributionService

Tuesday, July 11, 2017

Account Lockout Tracking


Logon to domain controller.

1. Open CMD (not power shell)
2. CD Windows\debug
3. Start debug
4. nltest /dbflag:2080ffff

5. find /i "user-name" c:\windows\debug\netlogon.* >user-name.txt

Wednesday, April 5, 2017

Cross Forest Exchange Migration

AD PowerShell Cross Forest Migration


MyLocalDomain
$LocalCredentials = Get-Credential
TheirRemoteDomain
$RemoteCredentials = Get-Credential

Mydomain\Myadmin
Theirdomain\Theiradmin

Prepare Before Migration:
.\Prepare-MoveRequest.ps1 -Identity remoteuser@theirdomain.net -RemoteForestDomainController theirdomaincontrollerfqdn -RemoteForestCredential $RemoteCredentials -UseLocalObject -OverwriteLocalObject -TargetMailUserOU "OU=mydomain,DC=net"

Migrate:
New-MoveRequest -Identity remoteuser@theirdomain.net -Remote -TargetDatabase "MDB01" -RemoteGlobalCatalog "theirdomaincontrollerfqdn" -RemoteCredential $RemoteCredentials -TargetDeliveryDomain "mydomain.net" -RemoteHostName "theirdomain.net"

With Bad Items & Suspend:
New-MoveRequest -Identity remoteuser@theirdomain.net -Remote -TargetDatabase "MDB01" -RemoteGlobalCatalog "theirdomaincontrollerfqdn" -RemoteCredential $RemoteCredentials -BadItemLimit 500 -AcceptLargeDataLoss -LargeItemLimit 100 -TargetDeliveryDomain "mydomain.net" -RemoteHostName "theirdomain.net" -SuspendWhenReadyToComplete

Bulk Migration:

Import File:
$InputFile = "C:\Batch01.csv"

Prepare Migration:
Import-Csv $InputFile | Foreach{.\Prepare-MoveRequest.ps1 -Identity $_.PrimarySmtpAddress -RemoteForestDomainController "theirdomaincontrollerfqdn" -RemoteForestCredential $RemoteCredentials -UseLocalObject -OverwriteLocalObject -TargetMailUserOU "Mydomain,DC=net"}

Migrate:
Import-Csv $InputFile | Foreach{Update-Recipient –Identity $_.PrimarySmtpAddress}

Bad Items & Suspend:
Import-Csv $InputFile | foreach {New-MoveRequest -Identity $_.PrimarySMTPAddress -Remote -TargetDatabase MDB01 -RemoteGlobalCatalog "theirdomaincontrollerfqdn" -RemoteCredential $RemoteCredentials -BadItemLimit 200 -AcceptLargeDataLoss -LargeItemLimit 100 -TargetDeliveryDomain "mydomain.net" -RemoteHostName "mail.theirdomain.net" -SuspendWhenReadyToComplete}

Check Status:
Get-MoveRequestStatistics -Identity username@theirdomain.net
Resume after 95% completion:
Resume-MoveRequest -Identity "username@theirdomain.net


Sunday, May 29, 2016

Wednesday, January 27, 2016

ActiveSync does not work for one user

Open Active Directory Users and Computers.
On the menu at the top of the console, click View > Advanced Features.
Locate and right-click the mailbox account in the console, and then click Properties.
Click the Security tab.
Click Advanced.
Make sure that the check box for "Include inheritable permissions from this object's parent" is selected.

Wednesday, September 16, 2015

EMC Source One search folder in outlook


Script below will create a folder in outlook to search archived items. Kind of browser inside outlook.
Save it as .vbs and execute or deploy through group policy on logon script.

=========================================================
Const olFolderInbox = 6

Dim FolderStatus
Dim OstFileCount

'Retrieve Username of the logged in user
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strUserName = wshShell.ExpandEnvironmentStrings( "%USERNAME%" )
'WScript.Echo "User Name: " & strUserName

'Define the path of the .ost file
Path = "C:\users\" & strUserName & "\appdata\local\Microsoft\Outlook"

'WScript.Echo "User Name: " & strUserName
'WScript.Echo "Path: " & Path

Function ReportFolderStatus(fldr)
   Dim fso, msg
   Set fso = CreateObject("Scripting.FileSystemObject")
   If (fso.FolderExists(fldr)) Then
      'MsgBox ("1")
      FolderStatus = "1"
   Else
      'MsgBox ("0")
      FolderStatus = "0"
   End If
   ReportFolderStatus = FolderStatus
End Function

'obiFile = "C:\users\" & strUserName & "\appdata\local\Microsoft\Outlook" & "\Outlook.sharing.xml.obi"
'WScript.Echo "File: " & obiFile

'http://blogs.technet.com/b/heyscriptingguy/archive/2005/01/14/how-can-i-tell-if-a-folder-has-any-files-with-a-specific-file-extension.aspx
Function IsOSTFilePresent(Path)
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strUserName = wshShell.ExpandEnvironmentStrings( "%USERNAME%" )

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService. _
   ExecQuery("SELECT * FROM CIM_DataFile WHERE Path = '\\Users\\" & strUserName & "\\AppData\\Local\\Microsoft\\Outlook\\' " & _
       "AND Drive = 'C:' AND Extension = 'ost'")

'Wscript.Echo "Number of .ost files found: " & colFiles.Count
IsOSTFilePresent = colFiles.Count
End Function

FolderStatus = ReportFolderStatus(Path)
'WScript.Echo "Folder Status: " & FileStatus

OstFileCount = IsOSTFilePresent(Path)
'WScript.Echo "# of Ost Files: " & OstFileCount

'Find out first if the folder exists, then check if the OST file exists, if yes, then proceed in creating the folder

If FolderStatus = 1 Then

If OstFileCount <> 0 Then

On Error Resume Next
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)

strFolderName = objFolder.Parent
Set objMailbox = objNamespace.Folders(strFolderName)

Set objNewFolder = objMailbox.Folders.Add("Tasnee Archive Search")
objNewFolder.WebViewURL = "https://archive.tasnee.com/search"
objNewFolder.WebViewOn = True

If Err.Number <> 0 Then
On Error GoTo 0
'the folder doesn't exist, create it
End If

End If

End If
======================================================