June 26, 2016

Hyper-V Replica with self-signed certificates

I have two standalone non-domain joined Hyper-V servers - HV01 and HV02. I need to configure Hyper-V replica between them. Many blog post and guides provide syntax for MakeCert tool. Interesting thing is that MakeCert is deprecated and it is recommended to use New-SelfSignedCertificate cmdlet instead. Of course it is great but there are some limitations of this cmdlet in PowerShell 4.0. Actually there is huge difference between New-SelfSignedCertificate cmdlet in PowerShell 4.0 and 5.0. I will create self-signed certificate using new cmdlet that's why I use Windows 10 with PowerShell 5.0. The name of Windows 10 workstation will be ADMIN01.

June 12, 2016

SQL Server 2016 - Always On Availability Groups

In this blog post I will provide basic step by step guide how to install and configure SQL Server 2016 with Always On Availability Groups. Migration WSUS from Windows Internal Database to Availability Group will be as example.

This guide has the following steps:
1. Preparation.
2. Installing SQL Server 2016 on both SQL servers.
3. Installing Failover Clustering Feature on SQL servers and enable AlwaysOn.
4. Working with WSUS.
5. Create Availability Group.
6. Create logins and grant permissions.
7. Create Availability Group Listener.
8. Finish WSUS server reconfiguration.


June 10, 2016

PowerShell - Working with archives

# Script begins
 [CmdletBinding()]
Param(
 [Parameter(Mandatory=$True)]
 [ValidateSet('Archive','Extract')]
 [String]$Action,

 [Parameter(Mandatory=$True)]
 [ValidateNotNull()]
 [String]$Source,

 [Parameter(Mandatory=$True)]
 [ValidateNotNull()]
 [String]$Destination
 )
 Add-Type -AssemblyName System.IO.Compression.FileSystem
    if ($Action -like "Archive") {
[io.compression.zipfile]::CreateFromDirectory($Source,$Destination)
}

    if ($Action -like "Extract") {
[io.compression.zipfile]::ExtractToDirectory($Source,$Destination)
}
# Script ends
Usage examples:
.\PSZip.ps1 -Action Archive -Source C:\Folder1 -Destination C:\Folder1.zip
.\PSZip.ps1 -Action Extract -Source C:\Folder1.zip -Destination C:\Folder1-unzipped

ESXi - vCenter behind NAT

1. vi /etc/vmware/vpxa/vpxa.cfg

<config>
<vpxa>
...
<serverip>Public vCenter IP Address</serverip>
<preserveserverip>true</preserveserverip>
</vpxa>
...
</config>

2. On gateway which holds Public vCenter IP Address add following NAT rules:
Internal vCenter IP - TCP 5989
Internal vCenter IP - UDP 902

3. In vCenter - Administration - vCenter Server Settings - Runtime Settings - Managed IP Address. Enter Public vCenter IP.

4. On ESXi via ssh: services.sh restart

Note: It is unsupported scenario.