July 27, 2017

PowerShell - Session Recording

How to store all typed commands and their output to a file? 

There is Start-Transcript cmdlet, which allows to do that. Example below will store all the output to Log.txt file.
PS C:\> Start-Transcript -Path C:\Scripts\Log.txt
Transcript started, output file is C:\Scripts\Log.txt 

Afterwards run Get-Date cmdlet to test.
PS C:\> Get-Date

Thursday, July 27, 2017 8:36:53 PM

Then Stop-Transcript to stop storing the session output.
PS C:\> Stop-Transcript
Transcript stopped, output file is C:\Scripts\Log.txt 

July 24, 2017

PowerShell - Listen TCP Port

PowerShell Script to open TCP port and listen for connections

Use cases

This script can be used to test firewall rules for Windows Servers located in different subnets, DMZ etc.

Parameters

-IP [IPv4 Address]
-PORT [TCP Port number]
-ListenTimeOut [Seconds]
-KeepAlive [Seconds]

Usage examples

Example below opens 443 TCP port on loopback interface and starts listening it for 1 minute. Once client is connected the session will be kept for 5 second before drop. 
.\TCPListen.ps1 -IP 127.0.0.1 -PORT 443 -ListenTimeOut 60 -KeepAlive 5

July 5, 2017

Azure AD Connect - installation error

Error: Unable to install the Synchronization Service. Please see the event log for additional details.


July 2, 2017

CloudStack - XenServer - single server deployment

This blog post shows how to deploy CloudStack on a single XenServer. Obviously non production example, simply a proof of concept case.

Requirements:
Subnet - 192.168.1.0/24.
Gateway - 192.168.1.254.
DNS Server - 192.168.1.253.
XEN1 (192.168.1.100) - XenServer 6.5 with all patches installed.
CLOUD1 (192.168.1.101) - Ubuntu 14.04.2 - "apt update | apt upgrade". VM running on XEN1.

Diagram: