SQL Server TSQL-Scripts

Here are som great scripts to manage SQL-server log See why you cannot shrink log files; select log_reuse_wait_desc,* from sys.databases as a1 –where name like ‘lois%’ order by a1.log_reuse_wait_desc See always on database status; Select last_commit_time, synchronization_state_desc,* from sys.dm_hadr_database_replica_states where database_id = 5 See how much data log files are using; DBCC SQLPERF(LOGSPACE); Shrink log …

Exchange Migration – Restart Apppool

Here is a gret script that restarts the Autodiscover Apppool every 5 minutes until there isn’t any mailboxes left on the oldserver. This one works for Exchange 2016 and 2013 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn; do{ $i = 1 $mail = (get-mailbox -server “kakster-oldexchange”).count Restart-WebAppPool MSExchangeAutodiscoverAppPool Write-host “Restarting AppPool” -ForegroundColor GREEN “Waiting for 3 minutes” Start-Sleep -Seconds 300 …

Issues with proxy server cetificate – Exchange 2016

Lately I went into an issue where users recieved a dialog box in outlook saying, there is a problem with the security certificate; The customer is running on Exchange Server 2016 and is using a Kemp Loadbalancer. This MS article; https://support.microsoft.com/da-dk/help/923575/error-message-when-outlook-tries-to-connect-to-a-server-by-using-an-rp states that there is a problem with the security channel Finnaly I  found this …

Office 365 Migration

Greate cmdlets to use during exchange migration This powershell cmdlet requieres that you are connected to exchange online. It will list the status of all mailboxes beeing synced. Get-MigrationUser -Status Syncing | Get-MigrationUserStatistics | ft Identity, PercentageComplete, State, TotalItemsInSourceMailboxCoun t, BytesTransferred, EstimatedTotalTransfersize Another cmd-let that gives some more detailed look Get-MoveRequestStatistics -identity e-mailaddress Replace emailaddress …

Can’t install windows feature – Error; 0x800f081f

I went into C:\windows\logs\cbs.log and found the following entry;   Store corruption, manifest missing for package: Package_1379_for_KB4025336~31bf3856ad364e35~amd64~~6.3.1.4 Mark store corruption flag because of package: Package_1379_for_KB4025336~31bf3856ad364e35~amd64~~6.3.1.4 After a lot of troubleshooting i found the solution; Go to windows catalogue and download the KB. extract the kb with the following command; <code language=cmd> Expand –F:* c:\fix\kb4025336\windows8.1-kb4025336-x64_b13c98376d2b720889d7cd0aaed50f772100bc49.msu c:\fix\kb4025336\extract …

Some users cannot start remote desktop from RDWEB

I ran into below problem – where a single user could not connect to remote desktop through rdgateway   I found this article; https://support.microsoft.com/en-us/help/2903333/terminal-services-client-connection-error-0xc000035b-when-you-use-lmco The solution here was method 1 in above article   HKLM\SYSTEM\CurrentControlSet\Control\Lsa LmCompatibilityLevel REGDWORD 3 or above. Method 2 is on the server; Set the EnforceChannelBinding registry value to 0 (zero) to …