Archive

Archive for the ‘Administration’ Category

XenDesktop Iconizer, a new tool for XenDesktop icons.

September 26, 2013 1 comment

Recently I read a post from XD Tipster on how to convert Png files into icons and use them for XenDesktop and Storefront… A very interesting piece, but a bit convoluted and long winded for my liking. I didn’t like the idea of the two website hops to get this information into XenDesktop format… So I decided to write two utilities:

icons

 

Iconizer:

 

iconizer

 

Iconizer Converts png files (with transparency supported) to an Ico file format , then in turn converts it To a Base 64 String.

You can send the data to the clipboard or import directly into XenDesktop if you have the powershell tools available.

 

added

 

It’s very simple, I wont bore you with the details, just convert and import. then map with powershell:

 

seticon

 

Reverse Iconizer:

 

reverseiconizer

 

I’m sure you can guess, takes the massive string of information stored in base64 and gives you a visual representation.

An example command line of how to do this is below:

 

poshtoclipreverse

 

Hey wait?

 

Why didn’t you integrate both of these?

Well it seems .net and Powershell have a limit on the data (string length) it can pull out of the pipeline. The default Citrix icon is close to 20,000 characters and results in you being unable to pull this data from powershell directly to .net. WIth great help from http://www.jonathanmedd.net/  we found that, yep the console does seem to have a roughly 8k char limit… Sure I could parse it to a file or the clipboard, but that was messy and frankly, I really couldn’t be arsed.

If you are up to the challenge I’ve got the source code for forward and reverse of the icon data below. I’ve also got a half assed attempt at creating a list… So fill your boots and take up the challenge if you wish.

 

Download:

 

As with most of my utilities the download links and source code are below, and a few icons to get you going:

System-Windows-icon Windows8

Download utilities.

Download Source Code.

Categories: Tools, XenDesktop Tags: , ,

Update to AppV launcher for Version 5

Just a quick note to say I’ve updated the AppV launcher tool to support Appv 5.

appv5

 

The app-V launcher tool is a self contained executable which lists your installed App-V packages and allows you to launch an executable in that virtual applications environment. This is particularly useful if you or your admins / users are not PowerShell friendly or you would prefer to not publish PowerShell scripts as programs.

You can get a copy of the latest version and/or it’s source code over here.

As an added benefit I’ve included source code for running PowerShell commands in .Net, so if you are interested in trying to do so grab the source code!

Introducing Wake On Lan manager

checklist_2_128x128x32Here’s a little tool I’ve been using in my home lab in anger for a few months and decided somebody else might get some use out of it.

2013-07-30 08_52_00-home.thinscale.net_3389 - Remote Desktop Connection

Wake on Lan manager is the latest tool I’ve written for managing your home lab environment for power saving. With Wake on Lan manager you can add a list of hosts or pc’s sitting at home behind a firewall and wake them up on demand. In my setup I leave one machine running in my lab at home every day and when I need to spin up the hypervisors I can simply right click and wake the computer up on demand:

2013-07-30 08_51_18-home.thinscale.net_3389 - Remote Desktop Connection

Wake on Lan will check the status of the machine via DNS and ping to check when the machine comes up at which time you can choose to RDP or SSH directly to the device.

How it works:

In order for Wake on lan manager to work correctly, you should register the correct DNS name and IP address in your lab for the hypervisors. The target machines must also support Magic Packet aka Wake on Lan.

Putty Support:

In order to get putty working, install wake on lan manager and browse down to the installation folder, find the wolmanager.exe.config and add the putty path as follows:

2013-07-30 08_58_39-home.thinscale.net_3389 - Remote Desktop Connection

Download link:

Download.

Requirements:

.Net Framework 4 client profile.

Another handy little tool, Move On Boot.

February 4, 2013 2 comments

red_copyUpon receiving a new dll from a support provider recently, I could not replace the existing file, as the file was in use by the system. A restart to safemode also wielded the same result. Dang!

I wanted to use the PendingFileRenameOperations registry key to instruct windows to copy a file during the boot process.

The issue with this key and behavior is that in order to tell windows to delete a file, the next line to the source file must be blank… if you manually try to add a blank line to regedit you receive the following error!

error

I needed an application to move a file during the boot process of windows before the service or handle held the file I wanted to replace open. I decided to write a new tool called MoveOnBoot.exe.

MoveOnBoot leverages the PendingFileRenameOperations registry key and the MoveFileEx Api to move the file on boot simply and easily.

Move on boot does the following:

  1. Adds the copy jobs to the PendingFileRename key you specify.
  2. Copies the new file into the target directory with an  _newer file extension.
  3. Optional: instructs windows to copy the current file to a _old extension
  4. instructs windows to replace the target file with the _Newer file.

 

How to use it:

Simply select the source and destination files as below:

UI

Optionally choose to backup the target file during the operation with the check box above.

Once you have added all the files you need to replace, you can check the queue by going to file > view pending operations:

results

And that’s it! restart the device and let windows do the hard work.

Optionally, if you chose to backup the file as part of the operation, you will find an _old file in the target directory as below:

after reboot

 

Download:

Stand alone Binary.

Source code.

Support information:

  • Requires Administrator privileges.
  • Requires .net framework 2.0 or greater.

 

Using powershell as a replacement for the Change Logon command in Remote Desktop Services.

August 9, 2012 8 comments

Still on my PowerShell buzz for the week, this is post 2 of 3 on some Remote Desktop Services / XenApp Powershell goodness!

This is one I’ve been meaning to post for quite some time, but other things got in the way. Mainly me forgetting how to use most of the powershell native methods due to having my head stuck in .net the last few weeks… Moving on…

While trying to find a method to check the status of logon’s to a Remote Desktop server via PowerShell, I didn’t have much luck. Either people are string scraping the output of the command using select-string or going to the registry and checking the raw Value with get-itemproperty. I wasn’t happy with either approach so I dug down into WMI and found the following.

From what I’ve found, the settings for enable, disable and the two drain modes are stored under the namespace root\cimv2\terminalservices. Under the class Win32_terminalservicesetting.

There are two properties we are interested in here:

  • logons (0 = enabled, 1 = disabled*)
  • SessionBrokerDrainMode (0 = Disabled, 1 = DrainUntilRestart, 2 = Drain)

*why oh why 1 is disabled is beyond me, but I digress.

The order of priority is enabled / disabled first, before the drain options are referenced.

So what does this tell us? Well, a change logon /query is simply performing the following simple checks:

Change Logon /query

gwmi win32_terminalservicesetting -N "root\cimv2\terminalservices" | %{
    if ($_.logons -eq 1){
    "Disabled"}
    Else {
        switch ($_.sessionbrokerdrainmode)
        {
            0 {"Enabled"}
            1 {"DrainUntilRestart"}
            2 {"Drain"}
            default {"something's not right here!"}
        }
    }
}

Ok that’s great and all, we’ve now replicated change logon /enable, but how do we set these values?

Easy! Using the native PowerShell $_.put() method, we can push values back in.

Below you will find each “Change Logon” option in server 2008 R2 and the corresponding WMI property.

Change logon /Enable

$temp = (gwmi win32_terminalservicesetting -N "root\cimv2\terminalservices")
$temp.sessionbrokerdrainmode=0
$temp.logons=0
$temp.put()

Change Logon /Disable

$temp = (gwmi win32_terminalservicesetting -N "root\cimv2\terminalservices")
$temp.logons=1
$temp.put()

Change Logon /Drain

$temp = (gwmi win32_terminalservicesetting -N "root\cimv2\terminalservices")
$temp.sessionbrokerdrainmode=2
$temp.put()

Change Logon /DrainUntilRestart

$temp = (gwmi win32_terminalservicesetting -N "root\cimv2\terminalservices")
$temp.sessionbrokerdrainmode=1
$temp.put()

And that’s it! now if you want to wrap this up in a function be my guest, or if you would like me to do so just drop me a line.

Follow

Get every new post delivered to your Inbox.

Join 2,301 other followers