Have Powershell speak Citrix

Just a little sunday fun here.

This is actually a part of a bigger plan involving Powershell, Octoblu and Citrix.
The idea being that voice feedback is enabled for scripts and flows.

Powershell can quite easy read strings for you.

In order to make this easy to use and of cource reusable I made a small function that can be put into a module. (let me know if you need a blog post on how to do this)

function Out-Speak {
    [CmdletBinding()]
    param (
        [parameter(Mandatory,
                   ValueFromPipeline=$true)]
        [String]$Text
    )

    Begin {
    }
    Process {
        foreach ($Line in $Text){
            Add-Type -AssemblyName System.Speech
            $synth = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer
            $synth.Speak("$Line")
        }
    }
    End {
    }
}

This can then be used to get Powershell to read strings for you using this syntax:

"This is a test to hear what it sounds like. Did you like what you just heard?" | Out-Speak

This can then be used to do some fun things with Citrix.

You can speak out the number of users currently connected with this – and speak out the usernames:

Add-PSSnapin -Name Citrix.Broker.Admin.V2

$UserCount = (Get-BrokerSession -SessionState Active).count
$UserName = (Get-BrokerSession -SessionState Active).UserFullName

"$UserCount active users is connected to the Citrix infrastructure right now.", "The usernames are:. $UserName" | Out-Speak

If you have a lot of users this is not very usefull but I’m sure you get the point…

What you can use this for is endless and only limited by your own imagination.

Later I’ll get back with further use of this in Octoblu flows an so on.

Please let me know if you have questions or comments.

/Brian

1 thought on “Have Powershell speak Citrix”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.