September 13, 2017

PowerShell - get Process ID of running service

How to get a Process ID of running service using PowerShell?

Get-WmiObject -Class win32_service | where {$_.Name -eq "Service Name"}

Example below will show a Process ID of “Task Scheduler” service:
Get-WmiObject -Class win32_service | where {$_.Name -eq "Schedule"}
ExitCode  : 0
Name      : Schedule
ProcessId : 11900
StartMode : Auto
State     : Running
Status    : OK

Or use more convenient way through Caption property:
Get-WmiObject -Class win32_service | where {$_.Caption -eq "Task Scheduler"}

Want to kill Task Scheduler process?

September 4, 2017

PowerShell - Sea Battle Game

Create 5 submarines and play against computer. Computer generates unique moves and ship placement every new game. Also there is a cheat mode available via (-EnableCheats) parameter to see computer's table.

September 1, 2017

Exchange 2013 - MaxHitsForFullTextIndexSearches

There is Microsoft Exchange 2013 bug, which limits search results by 250 items in Outlook.  

Possible fix can be achieved by amending Microsoft.Exchange.Store.Worker.exe.CONFIG file in BIN folder of your Exchange installation directory. Put the code below after </runtime>:

August 15, 2017

PowerShell - working with Progress Bar

This PowerShell script generates a number between 0 and 1000000. It calculates an average value, which is surprisingly leading to the middle. SecondsRemaining parameter from Write-Progress cmdlet is reused to show total time used. Additionally CPU load bar is added.

Script output example

August 9, 2017

PowerShell - PSObject property order (ordered hash tables)

How to change property order during PSObject output?

$Properties = @{
 a = 1
 b = 2
 c = 3
$Object = New-Object -TypeName PSObject -Property $Properties
c b a
- - -
3 2 1

What if you need a,b and then c property order?

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.


-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 -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.

Subnet -
Gateway -
DNS Server -
XEN1 ( - XenServer 6.5 with all patches installed.
CLOUD1 ( - Ubuntu 14.04.2 - "apt update | apt upgrade". VM running on XEN1.


June 20, 2017

Preparation for CCNP Cloud Certification

Today (19/06/2017) I passed Cisco 300-465 exam so I want to share how to prepare to it without taking any external training. Only self-study, hope someone will find it useful. In this post I will provide the list of preparation materials and resources, which will help to pass Designing the Cisco Cloud exam (CLDDES).

First of all you need to check exam topics on Cisco Learning Network - CLDDES Exam Topics I recommend also to look at authorized training. Partners provide official training, just find any through the partner locator and copy study topics, it will be useful to have.

Practice part. Register on dCloud portal using your Cisco ID. Complete all UCS, IAC, PSC labs. Very important to complete them if you don't work with these products. Additionally it is recommended to download and install trial versions of UCS Director, UCS Manager, IAC and Intercloud Fabric software in Lab environment.