Application virtualization, IoT and Cloud Computing, Blog of Sacha Thomet

sachathomet goes GitHub

Last 11 days I was in Las Vegas on the CTP meetings, Citrix Synergy and at the E2EVC. I get known a few new people and a bunch of ideas, some about Citrix but also how to continue with my Scripts and the community. (Other blog post will follow, maybe here or on the myCUGC site)

It’s not easy to manage all my Scripts, versions, bugs and feature request so I followed the hint of some people at Synergy and decided to push my larger Scripts to GitHub.
You can see now all my Scripts in GitHub repositories under – feel free to contribute!

Currently I have started with my two most popular Scripts:

Please be gentle to me if you are more experienced with GitHub than me, what is for sure if you work already more than 5 days with GitHub…. I’m really not the Software developer so I’m making baby steps with this repository thing. Hint’s are always appreciated.

Please use from now for feature-requests and bug reports the GitHub (issues) and no more the comment function in the blog.

victim of a good reputation – Low free pooled XenDesktops

The Citrix Director is not so bad, and with Version 7.7 it is still better because now it’s possible to send email alerts. But one problem I still have … our provided pooled XenDesktop which are used for remote access with private computers are victim of a good reputation … this means a good word-of-mouth advertising in our company more and more people are tempted to use it … and we need to know when the number of free pooled desktop is low. And no I won’t go the read the numbers every day in director or Citrix Studio.

So I created a small script which send me an email as soon a defined threshold of free desktops is reached:


The code is on GitHub:

Avoid blanks and dots in StoreFront 3.5 farm names!

Last day’s I upgraded my existing Storefront 3.01 to StoreFront 3.5 and in some farms I had a very bad issue after the upgrade, it seemed that all is ok but users are no more able to start any application or desktop.

On the StoreFront server I saw an Warning Event 28 from Citrix Store Service “ Failed to launch the resource “Farm Name.ApplicationName” as it was not found.


The issue was that a blank and a dot (.) was in my Farmname, seems this is a bug in SF3.5 that you can configure that but It won’t work!


after I changed the display name to something like xa65farm without blank and point all works well.

An awesome thing happened … I’m now a CTP

2 day’s ago I received a very pleasant email:

“Hello Sacha,
Congratulations! You have been selected to receive the Citrix Technology Professional (CTP) award! We’re thrilled to welcome you to this elite family group of technology experts!”

I’ve done in the last months and years some stuff for the Citrix community with this blog, with the participation on Twitter, Citrix Forums, and other Social media channels and I’m leading together with Stefan Beckmann the Swiss Citrix User Group Community. Also I participated on the development of the 1Y1-401 exam and I won the GeekOvation award 2015. Seem’s my passion for Citrix and contribution on the community get honored.

What is the CTP award?

This program is the highest recognition what a Citrix Expert can get and definitely a milestone in my career.

ctpMore information about the CTP Program you can get here:

More about the CTP 2016 class here: 

I’m very thankful to be chosen as a CTP and I’m sure that people surrounding me are jointly responsible for my success!

I want to say THANK YOU!

  • To my Family
  • To my coworkers and my employer Die Mobiliar (a swiss insurance company)
  • To Citrix, especially Perrine Crampton
  • To the CTPs I met last year at the Citrix Synergy on the GeekSpeak-Tonight with the GeekOvation Award, especially Aaron Parker who supported me on my Presentation, but also Carl Webster who supported me later with PoSh stuff and of course Jo Harder, GeekOvation MC (Mistress of Ceremonies), who crowned me 🙂
  • To my current and former coworkers who supported me always to keep my Citrix heart beating
  • To all other which supported me in my doing and I missed here  (Sorry!)

And I won’t forget to congratulate to the other new 2016 CTPs


What next? 

Now I’m really feel obligated to give even more back to the community, of course I will continue to contribute on forums, write more posts on this blog. But I’m pretty sure I will have the chance to hold one or two technical presentations … Good chance to improve my english language … :-S

Happy New Script – PVS 7.7 HealthCheck

We are close to the New Year 2016 and I want to wish you all the best for 2016!
I’m already happy now, because I can publish some hours after the PVS 7.7 release from Citrix this Script:

Today Citrix released XenApp/XenDesktop 7.7 and Citrix Provisioning Services 7.7. There are a bunch of new features, but for me the most important thing, beside of the Win10 support, is
….  drum roll ….
the new PVS PowerShell API. PoSh with PVS 7.6 and below was a pain …  To know what else is new in PVS look here: PVS 7.7 New in this release

Now PVS comes with a real PoSh interface which gave more back than a bundle of strings. I had the chance to play around with PVS 7.7 Tech Preview and so here you have already the PVS HealthCheck Script for Version 7.7 in a complete new developed version:


If you have a feature request or a bug report please post it direct on GitHub.

This version doesn’t work with PVS 7.6 and below, if you have an older version than 7.7 take this script: Citrix PVS HealthCheck 

Update 11.04.2016: Performance-Improvement, Change the order of the table, all the VDI status now at the end.
Update 09.05.2016: Bugfix & Input from Jay, get CPU/Memory/Disk usage of PVS.
Update 27.05.2016: Now my Script is on GitHub
I’m an absolute GitHub newbie … for this reason I leave it still also here as a download until I’m really comfortable with GitHub.

The code is on GitHub:

Control MyStrom smart plug by a trigger (ifttt or octoblu)

mystromSome weeks ago I bought my first smart plug from MyStrom. If you are living  in Switzerland you have only a limited choice of smart plugs because of the non EU standard plug (T13).

MyStrom is pretty cool because it mets almost all my requirement, there is a possibility to measure to power consumption within two rates (day and night), it’s controllable with the mobile phone app and there is a nice web interface.

But one thing I miss, I cannot react to triggers and power of the smart plug on a defined event. Like already in an earlier post mentioned there is a REST API which allows to control the plug from the internal network. (See Another LaMetric IoT script – power control)

Last day’s I just found the API documentation which allows to control the MyStrom out of the cloud: 

So I have now all to connect this Thing to the Internet and react on a trigger.

Possibility 1: The everything imaginable way,
MyStrom and Octoblu

mystromlogo      +      ocoblu

If you are using Octoblu beta, which is currently available for everyone for free you can create very intelligent workflows to control your smart plug. You can react to twitter and power of or on depending what is twittered, you can power off your heater as soon a temperature is reached, you can stop charge as soon your device have a defined state of charge.

The Things you connect use with Octoblu are nearly infinite.


Octoblu is for advanced use, and to be honest I’m also on the learning phase! I do not describe here more details for this case. There are a lot of sample blueprints on .  Octoblu was acquired by Citrix in 2015.

Possibility 2: The easy way,
MyStrom and IFTTT

 mystromlogo      +      iftttlogo

This way is suitable for “Home use” and for people who only want to create a simple workflow where a trigger initiate for example a Power On or Power Of of the smart plug.

All what you need is a Control-Script on a Webserver with PHP on the Internet, and a IFTTT account.

How it works: The script is very simple, it just handle the  authentication process on the API, read the AuthToken out of the JSON answer and Push out the payload with the AuthToken. IFTTT just take the trigger and call the script with the username, passwort and the payload which you can build from the API

Example: I want to control my smart plug by twitter, if I twitter #lightsoff

Step 1:

Take this script and put it on your webserver:


V0.1 by Sacha Thomet,, 12-2015

This script can be used to control the MyStrom power outlet with IFTTT.
In IFTTT you need to take the MAKER component to make a web request.

The script must be called with 3 parameters:
- Your MyStrom username (email)
- Your MyStrom password
- the decided payload
 e.g. ../device/switch?on=true%id=64002D012305 to turn on your device with Mac 64002D012305

 Documentation of all API calls:
 Attention! You need to replace in your payload all "&" with a "%" !!



//create variables from parameter
$email = ($_GET&#91;"email"&#93;);
$password = ($_GET&#91;"password"&#93;);
$payload = ($_GET&#91;"payload"&#93;);

//myStrom host with the parameters to gather the AuthToken
$host = "$email&password=$password";
$filestring = file_get_contents($host); 

//format the AuthToken that only the token remain from the JSON Answer
$startpos = 0;
while($pos = strpos($filestring, "authToken", $startpos))
 $string = substr($filestring, $pos, strpos($filestring, "name", $pos + 1) - $pos); 

 //echo $string. " ";
 $newstring = str_replace("authToken","","$string");
 $newstring2 = str_replace('"',"",$newstring);
 $newstring3 = str_replace(":","","$newstring2");
 $authCode = str_replace(",","","$newstring3");

 echo " AuthCode is $authCode 
" ;

 $startpos = $pos + 1;

// Because & cannot submitted in a $_GET we subsitute it with a %
$correctpayload = str_replace("%","&","$payload");

echo "Full payload is: $correctpayload&authToken=$authCode";

$fullpayload = "$correctpayload&authToken=$authCode";
$payloadString = file_get_contents($fullpayload); 


Step 2:

Create a recipe on IFTTT, use Twitter as Trigger and Maker as Action. In maker you create your request:


e.g. the payload to turn of the device with Mac 64002D012325 is:

The result should be that:


You create 2 of those recipies, one to Power On and one to Power Off

Now you can twitter you defined hashtags to control your smart plug.

Another LaMetric IoT script – power control

Because I have currently holiday here is another post which is not related to virtualization …

I combined my new “gadgets” the LaMetric time and my new wifi Smart-Plug from MyStrom. The goal was to report the current power consumption of power plug and the possibility to control the plug with the smart ticker.

MyStrom has a very straight forward API (, and the possibility to create apps for LaMetric is pretty easy what I’ve already mentioned in an past blog post.

All what is needed to implement this solution is:

  • a web server which can parse PHP
  • two small scripts
  • and a private app for LaMetric

This is the script to see the current power consumption:

    "frames": [
            "index": 0,
            "text": " <!--?php //$host = ""; //Call with parameter, e.g.: $host = "http://" . $_GET&#91;"host"&#93; . "/report"; $filestring = file_get_contents($host); $startpos = 0; while($pos = strpos($filestring, "\"power\"", $startpos)) { $string = substr($filestring, $pos, strpos($filestring, ",", $pos + 1) - $pos); //echo $string. " "; $newstring = str_replace("\"power\": ","","$string"); echo round($newstring, 2); $startpos = $pos + 1; } ?--> Watt",
            "icon": "i1692"

I just read the content from the API, which is already in JSON format, but I reformat it that it is in that way which I need to bring it to the LaMetric.
This is the script to control the power outlet:

<!--?php $host = "http://" . $_GET&#91;"host"&#93; . "/report"; $filestring = file_get_contents($host); $startpos = 0; while($pos = strpos($filestring, "relay", $startpos)) { $string = substr($filestring, $pos, strpos($filestring, "}", $pos + 1) - $pos); $newstring = str_replace("relay\": ","","$string"); //echo $newstring; $startpos = $pos + 1; } $newstring = str_replace(chr(13), "", $newstring); if ($newstring == "false ") { echo "Ist ausgeschaltet, wird nun eingeschaltet"; $URL = "http://" . $_GET&#91;"host"&#93; . "/relay?state=1"; $data = file_get_contents($URL); } else { echo "Ist eingeschaltet, wird nun ausgeschaltet"; $URL = "http://" . $_GET&#91;"host"&#93; . "/relay?state=0"; $data = file_get_contents($URL); } ?-->

And the LaMetric private app:

This simple poll app call the script on the webserver ( with the parameter of the MyStrom plug (

On button action the controller script is launched with change the status (off to on or visa verse)


( is the ip of my Power outlet. is the address of my web server, this can be a raspberry pi or a Synology.)

Monitor you Profile directories

Since I had worked as a Citrix administrator the size of the profile directories was always a contemporary issue. It’s a fact that with new technologies like Citrix User Profile Manager the possibilities are grown and the life is easier with exclusion lists and profile streaming features. But it’s still a topic to consider if you are a Citrix admin or system engineer. I worked in former company with tools like TreeSize ( or WinDir Stat ( But in some company they wont to spend money for tools which is only usable for one administrator or they don’t trust to OpenSource software (TreeSize).

I have the approach to solve every possible problem with on-board tools. So I created now a small script what give me the possibility to check my Profile directory with one recursive level so that I get each Size of a Profile within his subdirectories.:

# Created on: 10.2015 Version: 0.3
# Created by: Sacha Thomet
# Filename: GetSubdirSizes.ps1
# Description: This script checks some Citrix Provisioning Server, Farm, vDisk & Target device parameters.
# Prerequisite: None
# Call by : Manual
# Change Log:
# V0.1 first version
# V0.2 only 1 recursive subfolder
# V0.3 corrections of calculation

$path = "\\localhost\C$\temp\profiles\"
$top = "4000"
$outputpath = "C:\temp\SubdirSize-Report.txt"

Function Get-FolderSize
 $Sizes = 0
 ForEach ($Item in (Get-ChildItem $Path))
 If ($Item.PSIsContainer) {$Sizes = (Get-ChildItem $path"$Item" -recurse | Measure-Object -property length -sum).sum}
 Else {Write-Host "No Subfolder"}

 $SizeFormated = "{0:N2}" -f ($Sizes/1MB)
 New-Object PSObject -Property @{'Folder'=$Item;'Size'=$SizeFormated }
$outfile = Get-FolderSize $path | sort -property Size –Descending |select -first $top
$outfile | out-file $outputpath
echo $outfile

IoT, LaMetric and mouse issues …

In summer 2014 I became a backer for the Kickstarter project LaMetric. LaMetric was advertised as a smart ticker for life and business. To be honest the Internet of Things (IoT) topic was not so present for me in summer 2014 and I just decided to spend some money for a cool gadget.

Last week I finally received my LaMetric Time and today I need to say it’s one of the coolest gadget I bought in the last months. With the acquisition of Octoblu, what Citrix made early this year and promoted on Citrix Synergy (especially on the GeekSpeak Tonight …) I’m now more aware of IoT an it’s possibilities!

LaMetric is the perfect IoT output device!

First LaMetric app

The creation of apps is pretty easy! On the LaMetric developper portal you can create your push or poll apps. With push you can transmit data to the LaMetric servers in JSON code. W ith pull it’s also easy, you just need a webserver on which you have a file in the correct format.

On this way I created the EuroMillions app which display the current Jackpot. The data are fetched from and formatted with a small and simple PHP script:

 "frames": [
 "index": 0,
 "text": "<?php 
$host = ""; 
$filestring = file_get_contents($host); 
$startpos = 0; 
// <div class="est-jackpot">&euro;30<span class="amount">Million</span></div>

while($pos = strpos($filestring, ">&euro;", $startpos)) 
 $string = substr($filestring, $pos, strpos($filestring, "<span class=", $pos + 1) - $pos); 

 //echo $string. " "; 
 echo str_replace(">&euro;","","$string");

 $startpos = $pos + 1; 

?> Millions estimated in next Jackpot",
 "icon": "i616"




First IoT LaMetric Project


I’m living in an old farmhouse which is converted with some apartments, but it’s still a old house with a lot of wood. And the old problems … mouses. So I have now since some weeks 4 mouse traps installed, not the killing traps, only those which able me to take the mouse out of my apartment.

Problem: Every morning I need to check all mouse traps, because the traps are hidden positioned an annoying daily work. And with the risk that the mouse need to wait hours until I find them.


Now the concept of my first IoT project is to get alerted as soon a mouse get in a trap.

I want to solve this with:

  • a modified mouse trap with an attached window/door sensor, something like this
  • an Octoblu workflow
  • and LaMetric as Output device.

The result must be this:



Need some hours … I have to learn how to handle  octoblu and learn a bit of JSON.