<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Remko Weijnen&#039;s Blog (Remko&#039;s Blog)</title>
	<atom:link href="http://www.remkoweijnen.nl/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.remkoweijnen.nl/blog</link>
	<description>About Terminal Server, Citrix, Delphi and other stuff</description>
	<lastBuildDate>Thu, 17 May 2012 21:27:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Dear Visitor</title>
		<link>http://www.remkoweijnen.nl/blog/2007/11/01/dear-visitor/</link>
		<comments>http://www.remkoweijnen.nl/blog/2007/11/01/dear-visitor/#comments</comments>
		<pubDate>Thu, 01 Nov 2007 14:19:05 +0000</pubDate>
		<dc:creator>Remko</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2007/11/01/dear-visitor/</guid>
		<description><![CDATA[If this is your first visit, take your time and look around. Here are some things you might be looking for: SasLibEx: a library that can simulate the Secure Attention Sequence (Ctrl-Alt-Del) but it can even unlock a workstation or session without entering or needing the user&#8217;s credentials (and many more things). Who locks my [...]]]></description>
			<content:encoded><![CDATA[<div class="announcement_post"><p>If this is your first visit, take your time and look around. Here are some things you might be looking for:</p>
<ul>
<li><a  href="http://www.simulatesas.com/blog/tag/saslibex/">SasLibEx</a>: a library that can simulate the Secure Attention Sequence (Ctrl-Alt-Del) but it can even unlock a workstation or session without entering or needing the user&#8217;s credentials (and many more things).</li>
<li><a  href="/blog/2011/01/03/cannot-access-files-but-need-the-origin/">Who locks my file</a>?</li>
<li><a  href="http://www.remkoweijnen.nl/blog/2009/06/23/patch-vistas-kernel-to-address-more-than-4-gb-of-memory/">Patch 32 bit Windows to use the full 4 GB (and even more) memory</a></li>
<li>Patch Terminal Server to allow more Concurrent Sessions: <a  href="http://www.remkoweijnen.nl/blog/2008/08/31/patch-windows-2003-terminal-server-to-allow-more-than-2-concurrent-sessions/">2003</a>, <a  href="http://www.remkoweijnen.nl/blog/2008/12/19/windows-xp-x64-terminal-server-patch-part-1-mandatory/">Windows XP X64</a>, <a  href="http://www.remkoweijnen.nl/blog/2008/12/09/windows-2003-x64-terminal-server-patch/">2003 X64</a>, <a  href="http://www.remkoweijnen.nl/blog/2008/10/21/patch-windows-2008-terminal-server-to-allow-more-than-2-concurrent-sessions/">2008</a>, <a  href="http://www.remkoweijnen.nl/blog/2008/06/14/mutiple-concurrent-terminal-session-on-vista-sp1/">Vista</a></li>
<li>Some of my freeware tools such as <a  href="http://www.remkoweijnen.nl/blog/2007/10/17/launch-rdp-from-commandline/">LaunchRDP</a>, <a  href="http://www.remkoweijnen.nl/blog/2007/10/18/how-rdp-passwords-are-encrypted/">RDP Password Encryption</a>, <a  href="http://www.remkoweijnen.nl/blog/2007/11/01/query-active-directory-from-excel/">Active Directory Excel Addin</a>, <a  href="http://www.remkoweijnen.nl/blog/2007/10/25/rdp-clipboard-fix/">RDP Clipboard Fix</a> (well this list can go on and on, see also the Downloads section).</li>
</ul>
<p>Do you like my work? Did my work help you?</p>
<ul>
<li>Leave a comment and tell me how it was usefull to you.</li>
<li>If you want you can make a donation with the Paypal Donate Button in the right Sidebar.</li>
</ul>
<p>Thank you!</p>
<p><!--p wp_dlm_show_downloads(3,$no);--></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.remkoweijnen.nl/blog/2007/11/01/dear-visitor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Citrix Launcher Progress Update 1</title>
		<link>http://www.remkoweijnen.nl/blog/2012/05/17/citrix-launcher-progress-update-1/</link>
		<comments>http://www.remkoweijnen.nl/blog/2012/05/17/citrix-launcher-progress-update-1/#comments</comments>
		<pubDate>Thu, 17 May 2012 21:19:12 +0000</pubDate>
		<dc:creator>Remko</dc:creator>
				<category><![CDATA[Citrix]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Web Interface]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.remkoweijnen.nl/blog/?p=2609</guid>
		<description><![CDATA[After figuring out how to encode and decode the Citrix passwords my next step for the upcoming Citrix Launcher is experiment with config.xml and authenticating to the Citrix Web Interface. I imported the NFuse.dtd from the Citrix Web Interface into Delphi with the XML Data Binding Wizard. The results in an NFuse Unit so I [...]]]></description>
			<content:encoded><![CDATA[<p>After figuring out how to <a  href="http://www.remkoweijnen.nl/blog/2012/05/13/encoding-and-decoding-citrix-passwords/">encode and decode the Citrix passwords</a> my next step for the upcoming Citrix Launcher is experiment with config.xml and authenticating to the Citrix Web Interface.</p>
<p><a  class="thickbox no_icon" href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/05/image4.png" rel="gallery-2609" title="image"><img style="float: left; display: inline;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/05/image_thumb4.png" alt="image" width="45" height="39" align="left" /></a>I imported the NFuse.dtd from the Citrix Web Interface into Delphi with the XML Data Binding Wizard. The results in an NFuse Unit so I can easily create the XML data.</p>
<p>To create an authentication packet I use the following code:</p>
<p><span id="more-2609"></span></p><pre class="crayon-plain-tag">procedure TForm1.NFuseTest;
var
  NFuse: IXMLNFuseProtocolType;
begin
  NFuse := NewNFuseProtocol;
  NFuse.Version := '4.6';

  with NFuse.RequestAppData do
  begin
    ServerType.Add('x');
    ServerType.Add('win32');
    ClientType.Add('ica30');
    ClientType.Add('content');

    with Credentials do
    begin
      Username := 'administrator';
      Password.Encoding := 'ctx1';
      Password.NodeValue := Ctx1Encode('password');
      Domain.Type_ := 'NT';
      Domain.NodeValue := 'CONTOSO';
    end;

    ClientName := GetComputerName;
    ClientAddress.NodeValue := '192.168.2.23';
  end;
end;</pre><p>And this produces the following XML:</p><pre class="crayon-plain-tag">&lt;NFuseProtocol version=&quot;4.6&quot;&gt;
	&lt;RequestAppData&gt;
		&lt;ServerType&gt;x&lt;/ServerType&gt;
		&lt;ServerType&gt;win32&lt;/ServerType&gt;
		&lt;ClientType&gt;ica30&lt;/ClientType&gt;
		&lt;ClientType&gt;content&lt;/ClientType&gt;
		&lt;Credentials&gt;
			&lt;UserName&gt;administrator&lt;/UserName&gt;
			&lt;Password encoding=&quot;ctx1&quot;&gt;NFHALEBBMHGCLEBBMDGGKMAJNOHLLKBP&lt;/Password&gt;
			&lt;Domain type=&quot;NT&quot;&gt;CONTOSO&lt;/Domain&gt;
		&lt;/Credentials&gt;
		&lt;ClientName&gt;REMLAPTOP&lt;/ClientName&gt;
		&lt;ClientAddress&gt;192.168.2.23&lt;/ClientAddress&gt;
	&lt;/RequestAppData&gt;
&lt;/NFuseProtocol&gt;</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.remkoweijnen.nl/blog/2012/05/17/citrix-launcher-progress-update-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Encoding and Decoding Citrix Passwords</title>
		<link>http://www.remkoweijnen.nl/blog/2012/05/13/encoding-and-decoding-citrix-passwords/</link>
		<comments>http://www.remkoweijnen.nl/blog/2012/05/13/encoding-and-decoding-citrix-passwords/#comments</comments>
		<pubDate>Sun, 13 May 2012 19:55:02 +0000</pubDate>
		<dc:creator>Remko</dc:creator>
				<category><![CDATA[Citrix]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[Web Interface]]></category>

		<guid isPermaLink="false">http://www.remkoweijnen.nl/blog/?p=2586</guid>
		<description><![CDATA[I am working on a launcher tool for Citrix XenApp that can not only connect to a published application or published desktop but can also leverage Citrix Workspace Control to reconnect to disconnected and/or active sessions. There doesn&#8217;t seem to be any sdk that exposed the data we need so I am trying to reproduce [...]]]></description>
			<content:encoded><![CDATA[<p>I am working on a launcher tool for Citrix XenApp that can not only connect to a published application or published desktop but can also leverage Citrix Workspace Control to reconnect to disconnected and/or active sessions.</p>
<p>There doesn&#8217;t seem to be any sdk that exposed the data we need so I am trying to reproduce what the Citrix online plugi-in does.</p>
<p>I used a HTTP monitoring tool to capture the traffic between the Online plug-in and the Web Interface. First the online plug-in will retrieve the config.xml from the server specified via the Change Server option:</p>
<p><a  class="thickbox no_icon" href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/05/image2.png" rel="gallery-2586" title="Change Server - Citrix online plug-in"><img style="display: inline" title="Change Server - Citrix online plug-in" alt="What is the address of the server hosting your published resources? | Server Address | Example: servername (for non-secure connections) | https://servername (for secure connections)" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/05/image_thumb2.png" width="240" height="167" /></a></p>
<p><span id="more-2586"></span>
<p>The config.xml is a rather large xml file, the interesting part is the Request.Enumeration (I left out the other data): </p>
<p></p><pre class="crayon-plain-tag">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE PNAgent_Configuration SYSTEM &quot;PNAgent.dtd&quot;[]&gt;
&lt;PNAgent_Configuration xmlns:xsi=&quot;http://www.w3.org/2000/10/XMLSchema-instance&quot;&gt;
    &lt;Request&gt;
        &lt;Enumeration&gt;
            &lt;Location replaceServerLocation=&quot;true&quot; modifiable=&quot;true&quot; forcedefault=&quot;false&quot; RedirectNow=&quot;false&quot;&gt;http://2003xa/Citrix/PNAgent/enum.aspx&lt;/Location&gt;
            &lt;Smartcard_Location replaceServerLocation=&quot;true&quot;&gt;https://2003xa/Citrix/PNAgent/smartcard_enum.aspx&lt;/Smartcard_Location&gt;
            &lt;Integrated_Location replaceServerLocation=&quot;true&quot;&gt;http://2003xa/Citrix/PNAgent/integrated_enum.aspx&lt;/Integrated_Location&gt;
            &lt;Refresh&gt;
                &lt;OnApplicationStart modifiable=&quot;false&quot; forcedefault=&quot;true&quot;&gt;true&lt;/OnApplicationStart&gt;
                &lt;OnResourceRequest modifiable=&quot;false&quot; forcedefault=&quot;true&quot;&gt;false&lt;/OnResourceRequest&gt;
                &lt;Poll modifiable=&quot;false&quot; forcedefault=&quot;true&quot;&gt;
                    &lt;Enabled&gt;true&lt;/Enabled&gt;
                    &lt;Period&gt;6&lt;/Period&gt;
                &lt;/Poll&gt;
            &lt;/Refresh&gt;
        &lt;/Enumeration&gt;
        &lt;Resource&gt;
            &lt;Location replaceServerLocation=&quot;true&quot; modifiable=&quot;true&quot; forcedefault=&quot;false&quot; RedirectNow=&quot;false&quot;&gt;http://2003xa/Citrix/PNAgent/launch.aspx&lt;/Location&gt;
            &lt;Smartcard_Location replaceServerLocation=&quot;true&quot;&gt;https://2003xa/Citrix/PNAgent/smartcard_launch.aspx&lt;/Smartcard_Location&gt;
            &lt;Integrated_Location replaceServerLocation=&quot;true&quot;&gt;http://2003xa/Citrix/PNAgent/integrated_launch.aspx&lt;/Integrated_Location&gt;
        &lt;/Resource&gt;
        &lt;Reconnect&gt;
            &lt;Location replaceServerLocation=&quot;true&quot; modifiable=&quot;true&quot; forcedefault=&quot;false&quot; RedirectNow=&quot;false&quot;&gt;http://2003xa/Citrix/PNAgent/reconnect.aspx&lt;/Location&gt;
            &lt;Smartcard_Location replaceServerLocation=&quot;true&quot;&gt;https://2003xa/Citrix/PNAgent/smartcard_reconnect.aspx&lt;/Smartcard_Location&gt;
            &lt;Integrated_Location replaceServerLocation=&quot;true&quot;&gt;http://2003xa/Citrix/PNAgent/integrated_reconnect.aspx&lt;/Integrated_Location&gt;
        &lt;/Reconnect&gt;
        &lt;Change_Password&gt;
            &lt;Location replaceServerLocation=&quot;true&quot; modifiable=&quot;true&quot; forcedefault=&quot;false&quot; RedirectNow=&quot;false&quot;&gt;http://2003xa/Citrix/PNAgent/change_password.aspx&lt;/Location&gt;
        &lt;/Change_Password&gt;
        &lt;MachineControl&gt;
            &lt;Location replaceServerLocation=&quot;true&quot;&gt;http://2003xa/Citrix/PNAgent/desktopControl.aspx&lt;/Location&gt;
            &lt;Smartcard_Location replaceServerLocation=&quot;true&quot;&gt;https://2003xa/Citrix/PNAgent/smartcard_desktopControl.aspx&lt;/Smartcard_Location&gt;
            &lt;Integrated_Location replaceServerLocation=&quot;true&quot;&gt;http://2003xa/Citrix/PNAgent/integrated_desktopControl.aspx&lt;/Integrated_Location&gt;
        &lt;/MachineControl&gt;
    &lt;/Request&gt;
&lt;/PNAgent_Configuration&gt;</pre><p></p>
<p>From this xml data, the enum.aspx url is taken and another HTTP post is sent to that url which contains the following xml in my case:</p>
<p></p><pre class="crayon-plain-tag">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE NFuseProtocol SYSTEM &quot;NFuse.dtd&quot;&gt;&lt;NFuseProtocol version=&quot;4.6&quot;&gt;
	&lt;RequestReconnectSessionData&gt;
		&lt;Credentials&gt;
			&lt;UserName&gt;administrator&lt;/UserName&gt;
			&lt;Password encoding=&quot;ctx1&quot;&gt;NFHALEBBMHGCLEBBMDGGKMAJNOHLLKBP&lt;/Password&gt;
			&lt;Domain type=&quot;NT&quot;&gt;CONTOSO&lt;/Domain&gt;
		&lt;/Credentials&gt;
		&lt;ClientName&gt;REMLAPTOP&lt;/ClientName&gt;
		&lt;ClientName&gt;REMLAPTOP&lt;/ClientName&gt;
		&lt;ServerType&gt;win32&lt;/ServerType&gt;
		&lt;ClientType&gt;ica30&lt;/ClientType&gt;
		&lt;SessionType&gt;disconnected&lt;/SessionType&gt;
		&lt;SessionType&gt;active&lt;/SessionType&gt;
	&lt;/RequestReconnectSessionData&gt;
&lt;/NFuseProtocol&gt;</pre><p></p>
<p>Notice that the password is encoded so if we want to replicate the HTTP post data we need to be able to encode (and perhaps decode) the password.</p>
<p>The decoding seems to be named Ctx1 but I couldn&#8217;t find any information on how it should be encoded so I had to find it out myself.</p>
<p>I wrote a tool that that can encode and decode the passwords and I suspect the password decoding is the same as used for storing passwords in ica files (I haven&#8217;t checked that yet&#8230;):</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/05/image3.png" class="thickbox no_icon" rel="gallery-2586" title="Citrix Password Hasher by Remko Weijnen"><img style="display: inline" title="Citrix Password Hasher by Remko Weijnen" alt="Encrypt | Decrypt Password | Hash | Citrix | Ctx1" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/05/image_thumb3.png" width="419" height="84" /></a></p>
<p>The tool can be downloaded below.</p>
<a  class="downloadlink" href="http://www.remkoweijnen.nl/blog/download/CtxPass.zip" title="Version1.0 downloaded 29 times">Citrix Password Encoding & Decoding Utility (29)</a>
]]></content:encoded>
			<wfw:commentRss>http://www.remkoweijnen.nl/blog/2012/05/13/encoding-and-decoding-citrix-passwords/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setup was unable to verify drive C while installing Windows NT4 Terminal server on VMWare</title>
		<link>http://www.remkoweijnen.nl/blog/2012/05/10/setup-was-unable-to-verify-drive-c-while-installing-windows-nt4-terminal-server-on-vmware/</link>
		<comments>http://www.remkoweijnen.nl/blog/2012/05/10/setup-was-unable-to-verify-drive-c-while-installing-windows-nt4-terminal-server-on-vmware/#comments</comments>
		<pubDate>Thu, 10 May 2012 11:56:29 +0000</pubDate>
		<dc:creator>Remko</dc:creator>
				<category><![CDATA[VMWare]]></category>
		<category><![CDATA[Windows NT]]></category>

		<guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2012/05/10/setup-was-unable-to-verify-drive-c-while-installing-windows-nt4-terminal-server-on-vmware/</guid>
		<description><![CDATA[For a research project I tried to install Windows NT 4 Terminal Server on VMWare Workstation (version 8). The setup would always fail however with the following error: Obviously the installation doesn&#8217;t really fail because of too little memory and neither is the installation disc (an iso file) corrupt, it&#8217;s a bug. Fortunately this particular [...]]]></description>
			<content:encoded><![CDATA[<p>For a research project I tried to install Windows NT 4 Terminal Server on VMWare Workstation (version 8).</p>
<p>The setup would always fail however with the following error:</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/05/image.png" class="thickbox no_icon" rel="gallery-2581" title="Windows Terminal Server Setup"><img style="display: inline" title="Windows Terminal Server Setup" alt="Setup was unable to verify drive C:\ | Your computer may lack sufficient memory to carry out the verification, or your Windows Terminal Server CD-ROM may contain some corrupt files. | Press ENTER to continue" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/05/image_thumb.png" width="415" height="228" /></a></p>
<p>Obviously the installation doesn&#8217;t really fail because of too little memory and neither is the installation disc (an iso file) corrupt, it&#8217;s a bug.</p>
<p><span id="more-2581"></span>
<p>Fortunately this particular bug was fixed in SP3 (build number 4.00.1381.32772). So make sure you integrate SP3 or higher in your install media and the it installs perfectly:</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/05/image1.png" class="thickbox no_icon" rel="gallery-2581" title="Windows Terminal Server Setup"><img style="display: inline" title="Windows Terminal Server Setup" alt="This portion of Setup had completed successfully" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/05/image_thumb1.png" width="413" height="227" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.remkoweijnen.nl/blog/2012/05/10/setup-was-unable-to-verify-drive-c-while-installing-windows-nt4-terminal-server-on-vmware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bit Shifting in PowerShell</title>
		<link>http://www.remkoweijnen.nl/blog/2012/05/10/bit-shifting-in-powershell/</link>
		<comments>http://www.remkoweijnen.nl/blog/2012/05/10/bit-shifting-in-powershell/#comments</comments>
		<pubDate>Thu, 10 May 2012 10:14:36 +0000</pubDate>
		<dc:creator>Remko</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Bit Shifting]]></category>
		<category><![CDATA[shl]]></category>
		<category><![CDATA[shr]]></category>

		<guid isPermaLink="false">http://www.remkoweijnen.nl/blog/?p=2575</guid>
		<description><![CDATA[I needed to dome some Bit Shifting in PowerShell but unfortunately PowerShell lacks operator for Bit Shifting. I searched the .NET Framework for anything that allows for bit shifting but was unable to find anything suitable. I didn&#8217;t want to revert to C# so I implemented shift left and shift right functions in PowerShell. The [...]]]></description>
			<content:encoded><![CDATA[<p><img style="display: inline; float: right" align="right" src="http://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Rotate_left_logically.svg/210px-Rotate_left_logically.svg.png" width="129" height="86" />I needed to dome some <a  href="http://en.wikipedia.org/wiki/Bitwise_operation#Logical_shift">Bit Shifting</a> in PowerShell but unfortunately PowerShell lacks operator for Bit Shifting. I searched the .NET Framework for anything that allows for bit shifting but was unable to find anything suitable.</p>
<p>I didn&#8217;t want to revert to C# so I implemented shift left and shift right functions in PowerShell.</p>
<p>The code isn&#8217;t really pretty and could probably be improved (comments/improvements are welcome!) but here goes (please note that I implemented for bit shifting a byte):</p>
<p><span id="more-2575"></span></p><pre class="crayon-plain-tag"># convert (possible negative) value to Hex Byte
function valToHexByte([Int16]$val)
{
	$s = &quot;{0:x2}&quot; -f $val
	$s = &quot;0x&quot; + $s.Substring($s.Length - 2, 2)
	return [byte]$s
}

# shift bits left

function shl([int16]$val, [byte]$index=1)
{
	$b = valToHexByte $val
	$ba1 = New-Object System.Collections.BitArray($b)
	$ba2 = New-Object System.Collections.BitArray(8)

	for ($i=0 ; $i+$index -lt 8 ; $i++)
	{
		$ba2.Set($i + $index, $ba1.Get($i))
	}

	for ($i=0 ; $i -lt $index ; $i++)
	{
		$ba2.Set($i, 0)
	}
	$result =  New-Object System.Byte[] (1)
	$ba2.CopyTo($result, 0)
	return $result
}

# shift bits rights
function shr([Int16]$val, [byte]$index=1)
{
	$b = valToHexByte $val
	$ba1 = New-Object System.Collections.BitArray($b)
	$ba2 = New-Object System.Collections.BitArray(8)
	for ($i=7-$index ; $i -gt -1 ; $i--)
	{
		$ba2.Set($i, $ba1.Get($i + $index))
	}
	for ($i=7 ; $i -gt 7 - $index ; $i--)
	{
		$ba2.Set($i, $ba2.Get(7))
	}
	$result =  New-Object System.Byte[] (1)
	$ba2.CopyTo($result, 0)
	return $result
}</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.remkoweijnen.nl/blog/2012/05/10/bit-shifting-in-powershell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cookie Error on Citrix XenApp</title>
		<link>http://www.remkoweijnen.nl/blog/2012/03/29/cookie-error-on-citrix-xenapp/</link>
		<comments>http://www.remkoweijnen.nl/blog/2012/03/29/cookie-error-on-citrix-xenapp/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 08:02:10 +0000</pubDate>
		<dc:creator>Remko</dc:creator>
				<category><![CDATA[Citrix]]></category>
		<category><![CDATA[Cookies]]></category>
		<category><![CDATA[HDX]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[XenApp]]></category>

		<guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2012/03/29/cookie-error-on-citrix-xenapp/</guid>
		<description><![CDATA[A user reported that the following error while visiting a website on a Citrix XenApp server: I tried adding the site to the Trusted Sites List and adding the url to the Per Site Privacy list: But this didn&#8217;t work, but I noticed that the site was &#8220;flickering&#8221; a lot so I suspected that HDX [...]]]></description>
			<content:encoded><![CDATA[<p>A user reported that the following error while visiting a website on a Citrix XenApp server:</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image26.png" rel="lightbox" class="thickbox no_icon" title="Cookie Error"><img style="display: inline" title="Cookie Error" alt="You must have cookies enabled in order to user this tool. Please reload the page and try again." src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb26.png" width="415" height="94" /></a></p>
<p>I tried adding the site to the Trusted Sites List and adding the url to the Per Site Privacy list:</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image27.png" rel="lightbox" class="thickbox no_icon" title="image"><img style="display: inline" title="image" alt="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb27.png" width="415" height="256" /></a></p>
<p>But this didn&#8217;t work, but I noticed that the site was &#8220;flickering&#8221; a lot so I suspected that HDX Flash Acceleration was the problem.</p>
<p><span id="more-2574"></span>
<p>I imported the adm file for HDX (HdxFlash-Server.adm) into a GPO and added the site to the Per-URL-blacklist:</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/SNAGHTMLfc0ed9b.png" rel="lightbox" class="thickbox no_icon" title="SNAGHTMLfc0ed9b"><img style="display: inline" title="SNAGHTMLfc0ed9b" alt="SNAGHTMLfc0ed9b" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/SNAGHTMLfc0ed9b_thumb.png" width="415" height="310" /></a></p>
<p>That fixed the problem!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.remkoweijnen.nl/blog/2012/03/29/cookie-error-on-citrix-xenapp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reset Root Password on Linux Virtual Appliance</title>
		<link>http://www.remkoweijnen.nl/blog/2012/03/27/reset-root-password-on-linux-virtual-appliance/</link>
		<comments>http://www.remkoweijnen.nl/blog/2012/03/27/reset-root-password-on-linux-virtual-appliance/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 08:52:19 +0000</pubDate>
		<dc:creator>Remko</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Suse]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2012/03/27/reset-root-password-on-linux-virtual-appliance/</guid>
		<description><![CDATA[I needed to login as root on a Linux based virtual appliance to do some troubleshooting. In my case the appliance was running Suse Linux Enterprise. I booted the VA using the Ubuntu Live CD and opened a Terminal. Then I used the cfdisk tool (sudo cfdisk /dev/sda) to view the partitions: I assumed I [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to login as root on a Linux based virtual appliance to do some troubleshooting. In my case the appliance was running Suse Linux Enterprise.</p>
<p>I booted the VA using the <a  href="http://www.ubuntu.com/download/ubuntu/download" target="_blank">Ubuntu Live CD</a> and opened a Terminal. Then I used the cfdisk tool (sudo cfdisk /dev/sda) to view the partitions:</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image23.png" rel="lightbox" class="thickbox no_icon" title="Terminal"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Terminal" border="0" alt="cfdisk /dev/sda" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb23.png" width="419" height="270" /></a></p>
<p><span id="more-2567"></span>
<p>I assumed I needed sda2 so I mounted this partition:</p>
<p>  </p><pre class="crayon-plain-tag"># sudo su
# mkdir /mnt/va
# mount /dev/sda2 /mnt/va</pre><p></p>
<p>However if we try to change the password we get an error:</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image24.png" rel="lightbox" class="thickbox no_icon" title="chroot /mnt/va"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="chroot /mnt/va" border="0" alt="cannot open /dev/urandom for reading: No such file or directory | Cannot create salt for blowfish crtpy | Error: Password NOT changed. | passwd: Authentication token manipulation error" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb24.png" width="419" height="119" /></a></p>
<p>Apparently the /dev directory is filled while booting to make sure that it&#8217;s filled only with available devices.</p>
<p>To be able the change the password I mounted the /dev directory from the Ubuntu Live CD and then it works nicely:</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image25.png" rel="lightbox" class="thickbox no_icon" title="Terminal"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Terminal" border="0" alt="mkdir /mnt/va | mount /dev/sda2 /mnt/va | mount --bind /dev /mnt/va/dev | chroot /mnt/va | passwd" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb25.png" width="419" height="167" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.remkoweijnen.nl/blog/2012/03/27/reset-root-password-on-linux-virtual-appliance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create Active Directory Group with PowerShell</title>
		<link>http://www.remkoweijnen.nl/blog/2012/03/15/create-active-directory-group-with-powershell/</link>
		<comments>http://www.remkoweijnen.nl/blog/2012/03/15/create-active-directory-group-with-powershell/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 14:51:23 +0000</pubDate>
		<dc:creator>Remko</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2012/03/15/create-active-directory-group-with-powershell/</guid>
		<description><![CDATA[If you want to Create an Active Directory group with PowerShell there are a few things you need to be aware of: First of all there is no direct way to create new objects in Active Directory. You always need to bind to the Domain or an Organizational Unit and call the Create method. Example: [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to Create an Active Directory group with PowerShell there are a few things you need to be aware of:</p>
<p>First of all there is no direct way to create new objects in Active Directory. You always need to bind to the Domain or an Organizational Unit and call the Create method.</p>
<p>Example:</p>
<p>  </p><pre class="crayon-plain-tag"># Bind to OU
$ou = [ADSI]&quot;LDAP://OU=OU=Groups,DC=Contoso,DC=COM&quot;

# Create the Group
$group = $ou.Children.Add(&quot;CN=TestGroup&quot;, &quot;Group&quot;)
$group.CommitChanges()</pre><p></p>
<p>However the group is not yet complete:</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image22.png" rel="lightbox" class="thickbox no_icon" title="TestGroup Properties"><img style="display: inline" title="TestGroup Properties" alt="Group name (pre-Windows 2000)" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb22.png" width="404" height="184" /></a></p>
<p><span id="more-2554"></span>
<p>So we need to set the sAMAccountName property:</p>
<p></p><pre class="crayon-plain-tag"># Create the Group
# Bind to OU
$ou = [ADSI]&quot;LDAP://OU=OU=Groups,DC=Contoso,DC=COM&quot;

$group = $ou.Children.Add(&quot;CN=TestGroup&quot;, &quot;Group&quot;)

# Set Account Name
$group.sAMAccountName = &quot;TestGroup&quot;

# Commit Changes
$group.CommitChanges()</pre><p></p>
<p>however this will fail with the error message:</p>
<p></p><pre class="crayon-plain-tag">Exception calling &quot;CommitChanges&quot; with &quot;0&quot; argument(s): &quot;A constraint violation occurred. (Exception from HRESULT: 0x8007202F)&quot;</pre><p></p>
<p>This happens because we first need to call CommitChanges() before setting additional properties:</p>
<p></p><pre class="crayon-plain-tag"># Bind to OU
$ou = [ADSI]&quot;LDAP://OU=OU=Groups,DC=Contoso,DC=COM&quot;

# Create the Group
$group = $ou.Children.Add(&quot;CN=TestGroup&quot;, &quot;Group&quot;)

# Commit Changes
$group.CommitChanges()

# Set Account Name
$group.sAMAccountName = &quot;TestGroup&quot;

# Commit Changes
$group.CommitChanges()</pre><p></p>
<p>Last step is to change the group type, which can be done using the groupType property:</p>
<p></p><pre class="crayon-plain-tag"># These constants come from Iads.h
$ADS_GROUP_TYPE_GLOBAL_GROUP       = 0x2
$ADS_GROUP_TYPE_DOMAIN_LOCAL_GROUP = 0x4
$ADS_GROUP_TYPE_LOCAL_GROUP        = 0x4
$ADS_GROUP_TYPE_UNIVERSAL_GROUP    = 0x8
$ADS_GROUP_TYPE_SECURITY_ENABLED   = 0x80000000

# Set GroupType
$group.groupType = $ADS_GROUP_TYPE_GLOBAL_GROUP -bor $ADS_GROUP_TYPE_SECURITY_ENABLED</pre><p></p>
<p>And all the pieces together:</p>
<p></p><pre class="crayon-plain-tag"># These constants come from Iads.h
$ADS_GROUP_TYPE_GLOBAL_GROUP       = 0x2
$ADS_GROUP_TYPE_DOMAIN_LOCAL_GROUP = 0x4
$ADS_GROUP_TYPE_LOCAL_GROUP        = 0x4
$ADS_GROUP_TYPE_UNIVERSAL_GROUP    = 0x8
$ADS_GROUP_TYPE_SECURITY_ENABLED   = 0x80000000

# Bind to OU
$ou = [ADSI]&quot;LDAP://OU=Applications,OU=Groups,OU=GHZ,DC=ZORGMH,DC=LOCAL&quot;

# Create the Group
$group = $ou.Children.Add(&quot;CN=TestGroup&quot;, &quot;Group&quot;)

# Commit Changes
$group.CommitChanges()

# Important: first call CommitChanges() before setting other properties!
# Else you will get ERROR_DS_CONSTRAINT_VIOLATION (0x8007202F)

# Set Account Name
$group.sAMAccountName = &quot;TestGroup&quot;

# Set GroupType
$group.groupType = $ADS_GROUP_TYPE_GLOBAL_GROUP -bor $ADS_GROUP_TYPE_SECURITY_ENABLED

# Commit Changes
$group.CommitChanges()</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.remkoweijnen.nl/blog/2012/03/15/create-active-directory-group-with-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AuthorizationManager check failed when starting PowerShell</title>
		<link>http://www.remkoweijnen.nl/blog/2012/03/15/authorizationmanager-check-failed-when-starting-powershell/</link>
		<comments>http://www.remkoweijnen.nl/blog/2012/03/15/authorizationmanager-check-failed-when-starting-powershell/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 13:03:18 +0000</pubDate>
		<dc:creator>Remko</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2012/03/15/authorizationmanager-check-failed-when-starting-powershell/</guid>
		<description><![CDATA[When Launching a PowerShell script I noticed the following error: &#8220;AuthorizationManager check failed.&#8220; This happens because either the Current User or the All Users PowerShell profile is empty. Solution is to either delete the file (by default it&#8217;s not present) or fill it with at least one line of code. The path to the Current [...]]]></description>
			<content:encoded><![CDATA[<p>When Launching a PowerShell script I noticed the following error: &#8220;<em>AuthorizationManager check failed.</em>&#8220;</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image21.png" rel="lightbox" class="thickbox no_icon" title="PowerShell"><img style="display: inline" title="PowerShell" alt="AuthorizationManager check failed.| At line:1 char:2 | Microsoft.PowerShell_profile.ps1&#39;" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb21.png" width="415" height="117" /></a></p>
<p>This happens because either the Current User or the All Users PowerShell profile is empty.</p>
<p><span id="more-2551"></span>
<p>Solution is to either delete the file (by default it&#8217;s not present) or fill it with at least one line of code.</p>
<p>The path to the Current User profile is located in %UserProfile%\My Documents\WindowsPowerShell\profile.ps1.</p>
<p>The path to the All Users profile is located in %windir%\system32\WindowsPowerShell\v1.0\profile.ps1.</p>
<p>See also: <a  href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb613488(v=vs.85).aspx" target="_blank">Windows PowerShell Profiles</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.remkoweijnen.nl/blog/2012/03/15/authorizationmanager-check-failed-when-starting-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Imprivata fails to logon with special characters in the password</title>
		<link>http://www.remkoweijnen.nl/blog/2012/03/14/imprivata-fails-to-logon-with-special-characters-in-the-password/</link>
		<comments>http://www.remkoweijnen.nl/blog/2012/03/14/imprivata-fails-to-logon-with-special-characters-in-the-password/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 14:19:08 +0000</pubDate>
		<dc:creator>Remko</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[AutoIT]]></category>
		<category><![CDATA[Imprivata]]></category>

		<guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2012/03/14/imprivate-fails-to-logon-with-special-characters-in-the-password/</guid>
		<description><![CDATA[Interesting case today: customer uses Imprivate for two factor logon in combination with Citrix XenApp. Users reported that logons failed after they had changed their password. After contacting the users we learned that this only happened with special characters in the password like ! and +. To do the actual logon to Citrix Imprivata uses [...]]]></description>
			<content:encoded><![CDATA[<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/02/image17.png" class="thickbox no_icon" rel="gallery-2545" title="image"><img title="image" alt="image" align="right" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/02/image_thumb17.png" width="42" height="53" /></a>Interesting case today: customer uses Imprivate for two factor logon in combination with Citrix XenApp.</p>
<p>Users reported that logons failed after they had changed their password. After contacting the users we learned that this only happened with special characters in the password like ! and +.</p>
<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image20.png" rel="lightbox" class="thickbox no_icon" title="image"><img style="margin: 0px 5px 0px 0px; display: inline; float: left" title="image" alt="image" align="left" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb20.png" width="95" height="98" /></a>To do the actual logon to Citrix Imprivata uses an executable which is actually an AutoIT script compiled to an executable.</p>
<p>After authentication the executable get&#8217;s the password from the Imprivata Appliance.</p>
<p>I decompiled the executable to source and read the line that passes the password to XenApp:</p>
<p><span id="more-2545"></span></p><pre class="crayon-plain-tag">ControlSend(&amp;quot;Citrix online plug-in&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;[ID:1004]&amp;quot;, $password)</pre><p></p>
<p>I then checked the AutoIT documentation for the ControlSend function and learned there&#8217;s an extra parameter Flag with a default value of 0. This flags determines how keys are processed.</p>
<p>When Flag = 0 (default), special characters like + are used to indicate moving the cursor or indicate SHIFT. When Flag =1 the keys are send raw which is what we need for the passsword.</p>
<p>I changed the line to:</p>
<p></p><pre class="crayon-plain-tag">ControlSend(&amp;quot;Citrix online plug-in&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;[ID:1004]&amp;quot;, $password, 1)</pre><p></p>
<p>And now it works fine!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.remkoweijnen.nl/blog/2012/03/14/imprivata-fails-to-logon-with-special-characters-in-the-password/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

