John Liu Blog

Every drop counts

SQL Server Replication Setup

To setup SQL Server transactional replication, the publisher needs to be Standard or Enterprise edition. Subscriber can be any edition (except SQL Server Compact), but will require standard or Enterprise edition as well if configure merge (bi-directional) replication. We will need to create some local Windows accounts to run replication agents: Agent Location Account name Snapshot Agent Publisher <server name>\repl_snapshot Log Reader Agnet Publisher <server name>\repl_logreader Distribution Agnet Publisher/subscriber <server name>\repl_distribution Merge Agnet Publisher/subscriber <server name>\repl_merge On Publisher machine, create a file share for the snapshot folder.

Reallocate Windows Recovery Partition

After install Window, it will create a recovery partition following the system boot partition. If you want to reallocate the recovery partition, do the following. Disable existing Windows Recovery Partition use command line: reagentc /disable In command line window, run diskpart to remove the recovery partition: list disk select disk # (where # is the disk needing the recovery partition to be removed from. You can use Disk Management to confirm disk #) list partition select partition # (where # is the recovery partition) delete partition override (which will force delete the recovery partition) Now, expand your volume using Disk Management, and leave the similar size (~1024MB or as you see in the above list paritition) at the end of the drive for recreating the recovery partition.

Windows settings - GodMode

On your desktop, create a new folder and using the folliwng whole string, include dot and brackets, as the folder name. Now the folder icon will be change from folder icon so are chart type icon. If you double click the icon, it will open up the folder with almos all the windows settings you can access to. GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

PowerShell File Format Conversion

PowerShell has function to convert files between different formats. To convert Json to CSV: $procs = Get-Content -Path c:\temp\test.json | ConvertFrom-Json $procs | ConvertTo-Csv -Delimiter "`t" -NoTypeInformation | Out-File c:\temp\test.csv If the Json is nested $procs = Get-Content -Path c:\temp\test.json | ConvertFrom-Json $procs.Table1 | ConvertTo-Csv -Delimiter "`t" -NoTypeInformation | Out-File c:\temp\Table1.csv $procs.Table2 | ConvertTo-Csv -Delimiter "`t" -NoTypeInformation | Out-File c:\temp\Table2.csv

PowerShell script to update hosts file

You may need to add computer entery into hosts file for easy RDP access. Run following PowerShell script in administrator mode to add the target machine/IP into hosts file. Or you can manually open the C:\Windows\System32\drivers\etc\hosts file and edit it. #Run this script in Administrator mode cls $Srv = Read-Host -Prompt "Target Server Name" $IP = Read-Host -Prompt "Target Server IP" $newEntry =$IP + " " + $Srv $hostfile = Get-Content C:\Windows\System32\drivers\etc\hosts [bool]$Update = 0 if (-NOT ($IP | Select-String -Pattern "[0-9]+\.