<?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) &#187; script</title> <atom:link href="http://www.remkoweijnen.nl/blog/topics/script/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>Tue, 31 Jan 2012 15:37:53 +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>Get the location of an advertised shortcut</title><link>http://www.remkoweijnen.nl/blog/2012/01/18/get-the-location-of-an-advertised-shortcut/</link> <comments>http://www.remkoweijnen.nl/blog/2012/01/18/get-the-location-of-an-advertised-shortcut/#comments</comments> <pubDate>Wed, 18 Jan 2012 12:28:36 +0000</pubDate> <dc:creator>Remko</dc:creator> <category><![CDATA[script]]></category> <category><![CDATA[MSI]]></category> <category><![CDATA[VBS]]></category><guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2012/01/18/get-the-location-of-an-advertised-shortcut/</guid> <description><![CDATA[Installers can create so called Advertised Shortcuts in the Start Menu. I wanted to check the Target Path of such an shortcut but Explorer doesn&#8217;t show it: But we can easily retrieve the path using a small VB Script: Option Explicit Dim WshShell : Set WshShell = WScript.CreateObject(&#34;Wscript.Shell&#34;) Dim objShortcut : Set objShortcut = WshShell.CreateShortcut(WScript.Arguments(0)) [...]]]></description> <content:encoded><![CDATA[<p>Installers can create so called Advertised Shortcuts in the Start Menu. I wanted to check the Target Path of such an shortcut but Explorer doesn&#8217;t show it:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/01/image13.png" rel="lightbox" class="thickbox no_icon" title="Microsoft Visio 2010 Properties"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Microsoft Visio 2010 Properties" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/01/image_thumb13.png" alt="Microsoft Visio 2010 Properties | Shortcut Properties | Target Path" width="233" height="317" border="0" /></a></p><p><span id="more-2334"></span></p><p>But we can easily retrieve the path using a small VB Script:</p><div class="dean_ch" style="white-space: wrap;">Option Explicit<br /> Dim WshShell : Set WshShell = WScript.CreateObject(&quot;Wscript.Shell&quot;)<br /> Dim objShortcut : Set objShortcut = WshShell.CreateShortcut(WScript.Arguments(0))<br /> WScript.Echo(&quot;Target Path &nbsp;: &quot; &amp; objShortcut.TargetPath &amp; vbCrLf &amp; _<br /> &quot;Icon Location: &quot; &amp; objShortcut.IconLocation)</p><p>Set objShortcut = Nothing<br /> Set WshShell = Nothing</div><p>The scripts accepts the shortcut filename as a parameter so you can simply drag the shortcut to the script and it will show the Target Path and Icon Location:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/01/image14.png" rel="lightbox" class="thickbox no_icon" title="Windows Script Host"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Windows Script Host" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2012/01/image_thumb14.png" alt="Target Path  : C:\WINDOWS\Installer\{90140000-0057-0000-0000-0000000FF1CE}\visicon.exe |Icon Location: C:\WINDOWS\Installer\{90140000-0057-0000-0000-0000000FF1CE}\visicon.exe,0" width="419" height="98" border="0" /></a></p><p>Bonus Chatter: if you want to prevent an installer from creating Advertised Shortcuts set the DISABLEADVTSHORTCUTS MSI property to 1 (MsiExec /I MyMsi.msi DISABLEADVTSHORTCUTS=1).</p> ]]></content:encoded> <wfw:commentRss>http://www.remkoweijnen.nl/blog/2012/01/18/get-the-location-of-an-advertised-shortcut/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Citrix online plug-in received a corrupt ICA File</title><link>http://www.remkoweijnen.nl/blog/2011/12/13/citrix-online-plug-in-received-a-corrupt-ica-file/</link> <comments>http://www.remkoweijnen.nl/blog/2011/12/13/citrix-online-plug-in-received-a-corrupt-ica-file/#comments</comments> <pubDate>Tue, 13 Dec 2011 09:58:24 +0000</pubDate> <dc:creator>Remko</dc:creator> <category><![CDATA[Citrix]]></category> <category><![CDATA[script]]></category><guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2011/12/13/citrix-online-plug-in-received-a-corrupt-ica-file/</guid> <description><![CDATA[I was testing a Script I wrote to launch a Citrix XenApp session using the Ica Client Object. Typical code to do this may look like this: Const cHttpBrowser = &#34;someurl.local&#34; Const cColorDepth = 4 &#8216; Create the ICA Client Object Dim objIca : Set objIca = CreateObject(&#34;Citrix.IcaClient.2&#34;) &#8216; Set Credentials objIca.Username = &#34;JohnDoe&#34; objIca.SetProp [...]]]></description> <content:encoded><![CDATA[<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/image4.png" rel="lightbox" class="thickbox no_icon" title="image"><img style="display: inline; float: left" title="image" alt="image" align="left" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/image_thumb4.png" width="38" height="35" /></a>I was testing a Script I wrote to launch a Citrix XenApp session using the Ica Client Object. Typical code to do this may look like this:</p><div class="dean_ch" style="white-space: wrap;">Const cHttpBrowser = &quot;someurl.local&quot;<br /> Const cColorDepth = 4</p><p>&#8216; Create the ICA Client Object<br /> Dim objIca : Set objIca = CreateObject(&quot;Citrix.IcaClient.2&quot;)</p><p>&#8216; Set Credentials<br /> objIca.Username = &quot;JohnDoe&quot;<br /> objIca.SetProp &quot;ClearPassword&quot;, &quot;Secret01&quot;<br /> objIca.Domain = &quot;CONTOSO&quot;</p><p>&#8216; Connection Settings<br /> objIca.BrowserProtocol = &quot;HTTPonTCP&quot;<br /> objIca.TransportReconnectEnabled = True<br /> objIca.HttpBrowserAddress = cHttpBrowser</p><p>&#8216; Session Settings<br /> objIca.Address = &quot;MyApp&quot;<br /> objIca.Application = &quot;MyApp&quot;<br /> objIca.DesiredColor = cColorDepth<br /> objIca.ScreenPercent = 0 &#8216; Full Screen<br /> objIca.DesiredHRes = 0<br /> objIca.DesiredVRes = 0<br /> objIca.Launch = True</p><p>&#8216; Connect<br /> objIca.Connect</div><p>On my testmachine it ran nicely but on a customer machine the script failed with the error 2312 &#8220;<em>The Citrix online plug-in received a corrupt ICA File. The ICA File has no [ApplicationServer] section</em>&#8220;:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/SNAGHTML108b7fef.png" rel="lightbox" class="thickbox no_icon" title="Error number 2312"><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="Error number 2312" border="0" alt="The Citrix online plug-in received a corrupt ICA File. The ICA File has no [ApplicationServer] section" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/SNAGHTML108b7fef_thumb.png" width="419" height="98" /></a></p><p><span id="more-2242"></span><p>I couldn&#8217;t find any errors in my script so I fired up Process Monitor and noticed that the Ica Client Object creates a temporary .ica file in the %temp% folder. When it tried to write to this file this fails because access is denied:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/SNAGHTML10912948.png" rel="lightbox" class="thickbox no_icon" title="Process Monitor"><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="Process Monitor" border="0" alt="Process Monitor | ACCESS DENIED | temp folder | temporary ICA file" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/SNAGHTML10912948_thumb.png" width="419" height="265" /></a></p><p>I Checked the temporary .ica file and it was empty (0 bytes). Then I used the Stack View option from Process Monitor on the first ACCESS DENIED event:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/image5.png" rel="lightbox" class="thickbox no_icon" title="Event Properties"><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="Event Properties" border="0" alt="Process Monitor | Stack View" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/image_thumb5.png" width="419" height="286" /></a></p><p>From the stack we can see that fltMgr.sys is the last to touch the file (stack is from bottom to top). fltMgr is the File System Filter Driver which makes it likely that the Virus Scanner is blocking access. So I checked the Anti Virus log, McAfee VirusScan in my case:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/image6.png" rel="lightbox" class="thickbox no_icon" title="image"><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="image" border="0" alt="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/image_thumb6.png" width="419" height="42" /></a></p><p>The text is in Dutch, it says: Blocked by the access rule: maximum Anti-Spyware: prevent script execution from the temp folder.</p><p>So McAfee considers the .ica a script since it&#8217;s created by the process cscript.exe.</p><p>Unfortunately the Ica Client Object doesn&#8217;t offer a method or property to change the folder where the temporary ica file is created. I decided to have look at Wfica.ocx with Ida Pro and noticed that the <a  href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa364992(v=vs.85).aspx" target="_blank">GetTempPath</a> and <a  href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa364991(v=VS.85).aspx" target="_blank">GetTempFilename</a> API&#8217;s are used to assemble the filepath.</p><p>In the remarks section of the GetTempPath documentation on MSDN states that it looks first to the %TMP% environment variable.</p><p>So we can easily workaround this issue by changing the %TMP% variable before we run our script:</p><div class="dean_ch" style="white-space: wrap;">rem change TMP to the current folder<br /> Set TMP=%CD%<br /> cscript OurScript.vbs</div> ]]></content:encoded> <wfw:commentRss>http://www.remkoweijnen.nl/blog/2011/12/13/citrix-online-plug-in-received-a-corrupt-ica-file/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Embedding images in HTML</title><link>http://www.remkoweijnen.nl/blog/2011/12/02/embedding-images-in-html/</link> <comments>http://www.remkoweijnen.nl/blog/2011/12/02/embedding-images-in-html/#comments</comments> <pubDate>Fri, 02 Dec 2011 12:09:43 +0000</pubDate> <dc:creator>Remko</dc:creator> <category><![CDATA[PowerShell]]></category> <category><![CDATA[script]]></category> <category><![CDATA[base64]]></category> <category><![CDATA[embed]]></category> <category><![CDATA[hta]]></category><guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2011/12/02/embedding-images-in-html/</guid> <description><![CDATA[I was creating a small dialog in an .hta file and to make a little prettier for the user I included a company logo: But I wanted to deploy the .hta as a single file. And this can be done using data: followed by a base64 encoded png: &#60;img&#38;#160; src=&#34;data:image/png;base64, The Base64 encoding can easily [...]]]></description> <content:encoded><![CDATA[<p>I was creating a small dialog in an <a  href="http://en.wikipedia.org/wiki/HTML_Application" target="_blank">.hta file</a> and to make a little prettier for the user I included a company logo:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/SNAGHTMLdfa805.png" rel="lightbox" class="thickbox no_icon" title="SNAGHTMLdfa805"><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="SNAGHTMLdfa805" border="0" alt="SNAGHTMLdfa805" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/12/SNAGHTMLdfa805_thumb.png" width="270" height="206" /></a></p><p>But I wanted to deploy the .hta as a single file.</p><p><span id="more-2209"></span><p>And this can be done using data: followed by a base64 encoded png:</p><div class="dean_ch" style="white-space: wrap;">&lt;img&amp;#160; src=&quot;data:image/png;base64,</div><p>The Base64 encoding can easily be done with PowerShell:</p><div class="dean_ch" style="white-space: wrap;"><span class="kw1">function</span> <span class="re0">ConvertTo-<span class="re1">Base64</span></span><span class="br0">&#40;</span><span class="re3">$path</span><span class="br0">&#41;</span> <br /> <span class="br0">&#123;</span><br /> &nbsp; &nbsp;<span class="kw1">return</span> <span class="re4"><span class="br0">&#91;</span>Convert<span class="br0">&#93;</span></span>::<span class="me2">ToBase64String</span><span class="br0">&#40;</span><span class="br0">&#40;</span><span class="re0">Get-<span class="re1">Content</span></span> <span class="re3">$path</span> <span class="re2">-Encoding</span> <span class="kw3">byte</span><span class="br0">&#41;</span><span class="br0">&#41;</span><br /> <span class="br0">&#125;</span></p><p><span class="re0">ConvertTo-<span class="re1">Base64</span></span> <span class="st0">&quot;Picture.png&quot;</span></div><p>Example:</p><div class="dean_ch" style="white-space: wrap;">&lt;img src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADUAAAArCAIAAABXWFfMAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAaBJREFUWEftmNsOwyAIhrv3f+iuU2eonA9LXFLTq03sJz8I9nWe57HzuPh2HsfOcB9tH76UB2r8hxMsBQWMg3wLUIuT24MmBIEjfNe7MZD8SzOJDJ9Z94oXrs//2voorXwZMrgfL6WJL+wzztN2uXW+crgpt0VphY+H64sHY9GOGODD25Yp53ziDFJdKPFRzuMWJBHJyesxKSOyfIyyTdT7YITmZq5RIecKzSfAMXw4Fq18fb+CLsRfab6xJl/lrCq7/Dcm1+pb6L8/4CP9zZ0vev6qByHxPlvBsJ/P7Pm31GVuN+vvNr5U5SD7xYcvUY65I9B7vhTLGsmPXiHwfSLZrQjmBfXjp0lTw1fV4gNNh0oFfHjRsNyzPM4V3HxkCFYhLqES6a9GcaCuknmVIZ96UQr0971diz/TXIXrTaU0OJQMYiWfHIiq1kunCOdbnKf7TwhEmH0kh0BvhLPyzTtHJuxiX2H07wcwPFVB5SJmdxvsGeUMsd+epIwOkM0G2M1HXTGJfgIGZeQdzcanL3tLRQkSBloMa/iqaPA6u/O9ARufjI6hiJD2AAAAAElFTkSuQmCC&quot; /&gt;<br /> &lt;/PRE&lt;p&gt;</div> ]]></content:encoded> <wfw:commentRss>http://www.remkoweijnen.nl/blog/2011/12/02/embedding-images-in-html/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Remote Registry from 32 to 64 bit</title><link>http://www.remkoweijnen.nl/blog/2011/10/21/remote-registry-from-32-to-64-bit/</link> <comments>http://www.remkoweijnen.nl/blog/2011/10/21/remote-registry-from-32-to-64-bit/#comments</comments> <pubDate>Fri, 21 Oct 2011 07:05:11 +0000</pubDate> <dc:creator>Remko</dc:creator> <category><![CDATA[script]]></category> <category><![CDATA[Vista]]></category> <category><![CDATA[Windows 2003]]></category> <category><![CDATA[Windows 2008]]></category> <category><![CDATA[Windows 2008 R2]]></category> <category><![CDATA[Windows 7]]></category> <category><![CDATA[Windows XP]]></category><guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2011/10/21/remote-registry-from-32-to-64-bit/</guid> <description><![CDATA[Yesterday I needed to set a few registry keys remotely from a 32 bit windows machine to a 64 bit machine. I used reg.exe to set the key but even though it returned success the key wasn&#8217;t altered. As I suspected the key was written to the Wow6432Node. In the help I couldn&#8217;t find any [...]]]></description> <content:encoded><![CDATA[<p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/10/image5.png" rel="lightbox" class="thickbox no_icon" title="image"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/10/image_thumb5.png" width="40" height="38" /></a>Yesterday I needed to set a few registry keys remotely from a 32 bit windows machine to a 64 bit machine.</p><p>I used reg.exe to set the key but even though it returned success the key wasn&#8217;t altered.</p><p>As I suspected the key was written to the Wow6432Node. In the help I couldn&#8217;t find any switch to force reg.exe to use the 64-bit view.</p><p>On a 64 bit machine this is not a problem since both 32- and 64 bit versions of reg.exe exists. The 32 bit version of reg.exe defaults to the 32 bit view and the 64 bit version defaults to the 64 bit view.</p><p>But luckily reg.exe has a switch (that is not listed in the help) to force the View:</p><ul><span id="more-2146"></span><li><font color="#35383d">/reg:64 forces reg.exe to use the 64 bit view</font></li><li><font color="#35383d">/reg:32 forces reg.exe to use the 32 bit view</font></li></ul><p>Example:</p><div class="dean_ch" style="white-space: wrap;">Reg Query &quot;\\REMKOLAPTOP\HKLM\Software\Microsoft\Windows NT\CurrentVersion&quot;<br /> /v RegisteredOwner /reg:32</p><p>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion<br /> &nbsp; &nbsp; RegisteredOwner &nbsp; &nbsp;REG_SZ &nbsp; &nbsp;Microsoft</p><p> Reg Query &quot;\\REMKOLAPTOP\HKLM\Software\Microsoft\Windows NT\CurrentVersion&quot;<br /> /v RegisteredOwner /reg:64</p><p>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion<br /> &nbsp; &nbsp; RegisteredOwner &nbsp; &nbsp;REG_SZ &nbsp; &nbsp;rweijnen</div><p><strong>Note: Windows XP, 2003, Vista and Server 2008 require hotfix </strong><a  href="http://support.microsoft.com/kb/948698" target="_blank"><strong>kb948698</strong></a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.remkoweijnen.nl/blog/2011/10/21/remote-registry-from-32-to-64-bit/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Apply IP Configuration from a Database</title><link>http://www.remkoweijnen.nl/blog/2011/04/29/apply-ip-configuration-from-a-database/</link> <comments>http://www.remkoweijnen.nl/blog/2011/04/29/apply-ip-configuration-from-a-database/#comments</comments> <pubDate>Fri, 29 Apr 2011 08:27:27 +0000</pubDate> <dc:creator>Remko</dc:creator> <category><![CDATA[Altiris]]></category> <category><![CDATA[script]]></category> <category><![CDATA[SQL Server]]></category><guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2011/04/29/apply-ip-configuration-from-a-database/</guid> <description><![CDATA[I am currently deploying 64 Citrix XenApp servers with Altiris. The deployment consists of an OS Image, OS Configuration and finally Citrix XenApp and Applications. In the OS Configuration part the IP configuration needs to be applied and I decided to do this with a database. The database consists of 2 tables; one table with [...]]]></description> <content:encoded><![CDATA[<p>I am currently deploying 64 Citrix XenApp servers with Altiris. The deployment consists of an OS Image, OS Configuration and finally Citrix XenApp and Applications.</p><p>In the OS Configuration part the IP configuration needs to be applied and I decided to do this with a database.</p><p>The database consists of 2 tables; one table with the per host settings and one table with the global settings (such as DNS).</p><p>In the Altiris job both tables are read from an embedded VBScript and assigned to the NIC.</p><p><span style="text-decoration: underline;"><strong>Database configuration</strong></span></p><p>I created a database (SQL Server) called IPManagement with 2 tables:</p><p><a  rel="lightbox" href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image7.png" class="thickbox no_icon" title="image"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image_thumb7.png" border="0" alt="image" width="177" height="100" /></a></p><p>&nbsp;</p><p><span id="more-1695"></span></p><p>The globalconfig table has a name and a data field:</p><p><a  rel="lightbox" href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image8.png" class="thickbox no_icon" title="image"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image_thumb8.png" border="0" alt="image" width="244" height="74" /></a></p><p>And contains only the DNS settings:</p><p><a  rel="lightbox" href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image9.png" class="thickbox no_icon" title="image"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image_thumb9.png" border="0" alt="image" width="144" height="60" /></a></p><p>The hostconfig table has fields for hostname, ip address, netmask and default gateway:</p><p><a  rel="lightbox" href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image10.png" class="thickbox no_icon" title="image"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image_thumb10.png" border="0" alt="image" width="244" height="88" /></a></p><p>Some sample data:</p><p><a  rel="lightbox" href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image11.png" class="thickbox no_icon" title="image"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image_thumb11.png" border="0" alt="image" width="244" height="211" /></a></p><p><strong><span style="text-decoration: underline;"> </span></strong></p><p><strong><span style="text-decoration: underline;">Altiris Configuration</span></strong></p><p>In Altiris I have added the database as a custom data source, this can be done via Tools | Options | Custom Data Sources:</p><p><a  rel="lightbox" href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image12.png" class="thickbox no_icon" title="image"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image_thumb12.png" border="0" alt="image" width="244" height="238" /></a></p><p><a  rel="lightbox" href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image13.png" class="thickbox no_icon" title="image"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/04/image_thumb13.png" border="0" alt="image" width="244" height="197" /></a></p><p><strong><span style="text-decoration: underline;"> </span></strong></p><p><strong><span style="text-decoration: underline;">The Script:</span></strong></p><p>The final step is the VBScript, which use the <a  href="http://www.myitforum.com/articles/5/view.asp?id=5439" target="_blank">Custom Token feature</a> to retreive the data from the database:</p><div class="dean_ch" style="white-space: wrap;"><span class="co1">&#8216;Set Network Configuration</span><br /> <span class="co1">&#8216;vbscript</span><br /> IPAddress=<span class="kw1">Array</span><span class="br0">&#40;</span><span class="kw1">Trim</span><span class="br0">&#40;</span><span class="st0">&quot; %#IPManagement*&quot;</span>select ip from hostconfig where hostname=<span class="co1">&#8216;%NODEFULL%&#8217;&quot;% &quot;))</span><br /> NetMask=<span class="kw1">Array</span><span class="br0">&#40;</span><span class="kw1">Trim</span><span class="br0">&#40;</span><span class="st0">&quot; %#IPManagement*&quot;</span>select mask from hostconfig where hostname=<span class="co1">&#8216;%NODEFULL%&#8217;&quot;% &quot;))</span><br /> Gateway=<span class="kw1">Array</span><span class="br0">&#40;</span><span class="kw1">Trim</span><span class="br0">&#40;</span><span class="st0">&quot; %#IPManagement*&quot;</span>select gateway from hostconfig where hostname=<span class="co1">&#8216;%NODEFULL%&#8217;&quot;% &quot;))</span><br /> DNS=<span class="kw1">Array</span><span class="br0">&#40;</span><span class="kw1">Trim</span><span class="br0">&#40;</span><span class="st0">&quot; %#IPManagement*&quot;</span>select data from globalconfig where <span class="kw1">name</span>=<span class="co1">&#8216;dns1&#8242;&quot;% &quot;), Trim(&quot; %#IPManagement*&quot;select data from globalconfig where name=&#8217;dns2&#8242;&quot;% &quot;))</span></p><p>Metric = <span class="kw1">Array</span><span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span></p><p>strComputer = <span class="st0">&quot;.&quot;</span><br /> <span class="kw1">Set</span> objWMIService = <span class="kw1">GetObject</span><span class="br0">&#40;</span><span class="st0">&quot;winmgmts:\\&quot;</span> &amp; strComputer &amp; <span class="st0">&quot;\root\cimv2&quot;</span><span class="br0">&#41;</span><br /> <span class="kw1">Set</span> colItems = objWMIService.<span class="me1">ExecQuery</span><span class="br0">&#40;</span><span class="st0">&quot;Select * from Win32_NetworkAdapterConfiguration where IPEnabled = True&quot;</span>,,<span class="nu0">48</span><span class="br0">&#41;</span></p><p><span class="kw1">For</span> Each objItem in colItems</p><p>&nbsp; &nbsp;<span class="kw1">If</span> <span class="kw1">Left</span><span class="br0">&#40;</span>objItem.<span class="me1">IPAddress</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span>, <span class="nu0">6</span><span class="br0">&#41;</span> = <span class="st0">&quot;10.250&quot;</span> <span class="kw1">Then</span><br /> &nbsp; &nbsp;&nbsp; &nbsp;WScript.<span class="me1">Echo</span><span class="br0">&#40;</span><span class="st0">&quot;Found Adapter, current adres is: &quot;</span> &amp;amp; objItem.<span class="me1">IPAddress</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span> &amp;amp; <span class="st0">&quot; Desired Address is: &quot;</span> &amp; IPAddress<span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#41;</span><br /> &nbsp; &nbsp;&nbsp; &nbsp;Ret = objItem.<span class="me1">EnableStatic</span><span class="br0">&#40;</span>IPAddress, NetMask<span class="br0">&#41;</span><br /> &nbsp; &nbsp;&nbsp; &nbsp;WScript.<span class="me1">Echo</span><span class="br0">&#40;</span><span class="st0">&quot;EnableStatic returned: &quot;</span> &amp; Ret<span class="br0">&#41;</span></p><p>&nbsp; &nbsp;&nbsp; &nbsp;<span class="kw1">If</span> Ret = <span class="nu0">0</span> <span class="kw1">Then</span><br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Ret = objItem.<span class="me1">SetGateWays</span><span class="br0">&#40;</span>Gateway, Metric<span class="br0">&#41;</span><br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;WScript.<span class="me1">Echo</span><span class="br0">&#40;</span><span class="st0">&quot;SetGateWays returned: &quot;</span> &amp; Ret<span class="br0">&#41;</span>&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</p><p>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Ret = objItem.<span class="me1">SetDNSServerSearchOrder</span><span class="br0">&#40;</span>DNS<span class="br0">&#41;</span><br /> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;WScript.<span class="me1">Echo</span><span class="br0">&#40;</span><span class="st0">&quot;SetDNSServerSearchOrder returned: &quot;</span> &amp; Ret<span class="br0">&#41;</span><br /> &nbsp; &nbsp;&nbsp; &nbsp;<span class="kw1">End</span> <span class="kw1">If</span></p><p>&nbsp; &nbsp;<span class="kw1">End</span> <span class="kw1">If</span><br /> <span class="kw1">Next</span></p><p>WScript.<span class="me1">Quit</span><span class="br0">&#40;</span>Ret<span class="br0">&#41;</span></div><p>Note that I had to do a little trick using the Trim statement and a space to get a correct assignment to the variables. Without the space Altiris doesn&#8217;t properly recognize the custom token.</p><p>The array is necessary beasue the EnableStatic and SetGateways Methods require array parameters even when there&#8217;s just a single entry.</p> ]]></content:encoded> <wfw:commentRss>http://www.remkoweijnen.nl/blog/2011/04/29/apply-ip-configuration-from-a-database/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Using Fast User Switching on domain XP computers</title><link>http://www.remkoweijnen.nl/blog/2011/01/30/using-fast-user-switching-on-domain-xp-computers/</link> <comments>http://www.remkoweijnen.nl/blog/2011/01/30/using-fast-user-switching-on-domain-xp-computers/#comments</comments> <pubDate>Sun, 30 Jan 2011 19:42:20 +0000</pubDate> <dc:creator>daNIL</dc:creator> <category><![CDATA[script]]></category> <category><![CDATA[Terminal Server]]></category> <category><![CDATA[Windows Internals]]></category> <category><![CDATA[Windows XP]]></category><guid isPermaLink="false">http://www.remkoweijnen.nl/blog/?p=1344</guid> <description><![CDATA[As you may know, Fast User Switching (FUS) is not available (disabled) on Windows XP computers joined to a domain, Microsoft confirms this in kb280758. However, Microsoft doesn&#8217;t tell us there&#8217;s an undocumented registry value that allows us to have FUS when joined to a domain! To enable FUS you need to set the DWORD registry value HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\ForceFriendlyUI. It can [...]]]></description> <content:encoded><![CDATA[<p>As you may know, Fast User Switching (FUS) is not available (disabled) on Windows XP computers joined to a domain, Microsoft confirms this in <a  href="http://support.microsoft.com/kb/280758" target="_blank">kb280758</a>.</p><p>However, Microsoft doesn&#8217;t tell us there&#8217;s an undocumented registry value that allows us to have FUS when joined to a domain!</p><p>To enable FUS you need to set the <strong>DWORD</strong> registry value <em>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\ForceFriendlyUI</em>.</p><p>It can also be set by Group Policy at <em>HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System.</em></p><p>When the value is set to 1, and <em>LogonType</em> key is also set to 1, it allows you to use a Friendly UI on a computer joined in a domain:<br /> <span id="more-1344"></span></p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/01/image22.png" class="thickbox no_icon" rel="gallery-1344" title="image"><img style="display: inline; border: 0px;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/01/image_thumb22.png" border="0" alt="image" width="424" height="316" /></a></p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/01/image23.png" class="thickbox no_icon" rel="gallery-1344" title="image"><img style="display: inline; border: 0px;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/01/image_thumb23.png" border="0" alt="image" width="424" height="493" /></a></p><p>You can even set <em>AllowMultipleTSSessions</em> value to 1, which will allow you to have multiple users logged on!</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/01/image24.png" class="thickbox no_icon" rel="gallery-1344" title="image"><img style="display: inline; border: 0px;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/01/image_thumb24.png" border="0" alt="image" width="424" height="373" /></a></p><p>The only problem is that the &#8220;Friendly UI&#8221; doesn&#8217;t always allow to logon as a domain user. Only when no-one is logged on you can press the <strong>Ctrl+Alt+Delete</strong> sequence twice to get to the Classis Logon Screen where you can logon with Domain Credentials:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/01/image25.png" class="thickbox no_icon" rel="gallery-1344" title="image"><img style="display: inline; border: 0px;" title="image" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/01/image_thumb25.png" border="0" alt="image" width="424" height="316" /></a></p><p>If we disconnect the console session, for example, by using the <a  href="http://msdn.microsoft.com/en-us/library/cc770592(v=ws.10).aspx">tsdiscon.exe</a> tool we are also able to go to the Classic Logon Screen.</p><p>I&#8217;ve created a few files, which you can place, say to the All Users Desktop (<em>CSIDL_COMMON_DESKTOPDIRECTORY)</em> folder (i.e. &#8220;C:\Documents and Settings\All Users\Desktop&#8221;) to make them available to all users:</p> <a  class="downloadlink" href="http://www.remkoweijnen.nl/blog/download/Friendly-UI.zip" title="Version1.0 downloaded 286 times">Friendly UI batch tools (286)</a><p>There is also a slightly modified version of &#8220;<a  href="http://www.remkoweijnen.nl/blog/2008/11/26/executing-a-fast-user-switch-programmatically-part-2/">Switch User</a>&#8221; application, which now adjust the value of <em>AllowMultipleTSSessions, LogonType</em> and <em>ForceFriendlyUI </em>keys programmatically (if required) for the time needed to logon the user and then reverts them back.</p><p>It also supports a <strong>/Server=ServerName</strong> option, which allows you to execute it on another machine.</p><p>Please note that you cannot log on domain users in this way!</p> <a  class="downloadlink" href="http://www.remkoweijnen.nl/blog/download/SwitchUser-1-21.zip" title="Version1.21 downloaded 213 times">Switch User 1.21 (213)</a><p>P.S. &#8220;Bugs&#8221;</p><p>1) If you&#8217;ve logged on as a domain user, and are set the logon type to friendly UI, be careful: if you lock your current session, you won&#8217;t be able to return to it in a normal way &#8211; &#8220;Friendly UI&#8221; doesn&#8217;t support domain logged users and you just won&#8217;t be listed in a users list! But, of course, you can log in as a different user, start Task Manager, click on &#8220;Users&#8221; tab, and connect to your original session manually. You can also use &#8220;&#8221;Turn Friendly UI Off.bat&#8221; file to switch Friendly UI off and be able to lock your workstation normally.</p><p>2) If you connect via RDP session, you&#8217;ll still get a &#8220;Friendly UI&#8221;. It won&#8217;t be fully functional as it was not designed to be used from RDP session.</p><p>3) Explorer doesn&#8217;t show you &#8220;Switch user&#8221; option when you try to logoff the current user, but you can lock workstation by using &#8220;Window+L&#8221; shortcut or use the batch file above.</p> ]]></content:encoded> <wfw:commentRss>http://www.remkoweijnen.nl/blog/2011/01/30/using-fast-user-switching-on-domain-xp-computers/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PowerShell Script to raise Citrix Video Memory</title><link>http://www.remkoweijnen.nl/blog/2011/01/28/powershell-script-to-raise-citrix-video-memory/</link> <comments>http://www.remkoweijnen.nl/blog/2011/01/28/powershell-script-to-raise-citrix-video-memory/#comments</comments> <pubDate>Fri, 28 Jan 2011 14:23:08 +0000</pubDate> <dc:creator>Remko</dc:creator> <category><![CDATA[Citrix]]></category> <category><![CDATA[PowerShell]]></category> <category><![CDATA[script]]></category> <category><![CDATA[Windows 2003]]></category> <category><![CDATA[Windows Internals]]></category><guid isPermaLink="false">http://www.remkoweijnen.nl/blog/?p=1316</guid> <description><![CDATA[On a Citrix XenApp 5 environment a user reported that he was unable to start a Full Screen session on a Dual Monitor Configuration. He received this error message: Citrix has a KB Article: &#8220;How to Allow More Memory for Session Graphics on Windows Server 2003&#8221; that explains exactly how we can solve this. We [...]]]></description> <content:encoded><![CDATA[<p>On a Citrix XenApp 5 environment a user reported that he was unable to start a Full Screen session on a Dual Monitor Configuration.</p><p>He received this error message:</p><p><a  rel="lightbox" href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/01/foutmelding-2.png" class="thickbox no_icon" title="foutmelding (2)"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="foutmelding (2)" src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2011/01/foutmelding-2_thumb.png" border="0" alt="foutmelding (2)" width="244" height="78" /></a></p><p>Citrix has a KB Article: &#8220;<a  href="http://support.citrix.com/article/CTX114497" target="_blank">How to Allow More Memory for Session Graphics on Windows Server 2003</a>&#8221; that explains exactly how we can solve this.</p><p>We need to change the <em>MaxLVBMem</em> registry value and we can use the Excel Sheet from the KB Article to calculate the proper value.</p><p>Please don&#8217;t set this value too high because a higher value means you will restrict other kernel memory pools.</p><p>You also need to deny the SYSTEM account the SetValue permission on the <em>HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management</em> key to prevent the Citrix IMA service from overwriting the new value.</p><p>So I wrote a small PowerShell script to change the permission and set the value:</p><div class="dean_ch" style="white-space: wrap;"><span class="re3">$keyName</span> = <span class="st0">&quot;SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\icawd\thin16&quot;</span><br /> <span class="re3">$valueName</span> = <span class="st0">&quot;MaxLVBMem&quot;</span><br /> <span class="co1"># Calculate your value! http://support.citrix.com/article/CTX114497</span><br /> <span class="re4"><span class="br0">&#91;</span><span class="kw3">int</span><span class="br0">&#93;</span></span><span class="re3">$value</span> = 0xc00000</p><p><span class="co1"># Set Identity to SYSTEM via it&#8217;s Well Known SID</span><br /> <span class="re4"><span class="br0">&#91;</span><span class="kw3">System</span>.<span class="me1">Security</span>.<span class="me1">Principal</span>.<span class="me1">SecurityIdentifier</span><span class="br0">&#93;</span></span><span class="re3">$ident</span> = <span class="st0">&quot;S-1-5-18&quot;</span></p><p><span class="co1"># Open Registry Key (with Write Permissions)</span><br /> <span class="re3">$regKey</span> = <span class="re0">Get-<span class="re1">Item</span></span> <span class="st0">&quot;HKLM:&quot;</span><br /> <span class="re3">$regKey</span> = <span class="re3">$regKey</span>.<span class="me1">OpenSubKey</span><span class="br0">&#40;</span><span class="re3">$keyName</span>, <span class="re3">$true</span><span class="br0">&#41;</span></p><p><span class="co1"># Fetch Existing permissions</span><br /> <span class="re3">$acl</span> = <span class="re3">$regKey</span>.<span class="me1">GetAccessControl</span><span class="br0">&#40;</span><span class="br0">&#41;</span></p><p><span class="co1"># Construct a new Ace</span><br /> <span class="re3">$rights</span> = <span class="re4"><span class="br0">&#91;</span>Enum<span class="br0">&#93;</span></span>::<span class="me2">Parse</span><span class="br0">&#40;</span><span class="re4"><span class="br0">&#91;</span>Security.<span class="me1">AccessControl</span>.<span class="me1">RegistryRights</span><span class="br0">&#93;</span></span>, <span class="st0">&quot;SetValue&quot;</span><span class="br0">&#41;</span><br /> <span class="re3">$deny</span> = <span class="re4"><span class="br0">&#91;</span>Enum<span class="br0">&#93;</span></span>::<span class="me2">Parse</span><span class="br0">&#40;</span><span class="re4"><span class="br0">&#91;</span>Security.<span class="me1">AccessControl</span>.<span class="me1">AccessControlType</span><span class="br0">&#93;</span></span>, <span class="st0">&quot;Deny&quot;</span><span class="br0">&#41;</span><br /> <span class="re3">$rule</span> = <span class="re0">New-<span class="re1">Object</span></span> Security.<span class="me1">AccessControl</span>.<span class="me1">RegistryAccessRule</span><span class="br0">&#40;</span><span class="re3">$ident</span>, <span class="re3">$rights</span>, <span class="re3">$deny</span><span class="br0">&#41;</span></p><p><span class="co1"># Add the new Ace to the Acl</span><br /> <span class="re3">$acl</span>.<span class="me1">AddAccessRule</span><span class="br0">&#40;</span><span class="re3">$rule</span><span class="br0">&#41;</span></p><p><span class="co1"># Apply the new Acl to the Registry key:</span><br /> <span class="re3">$regKey</span>.<span class="me1">SetAccessControl</span><span class="br0">&#40;</span><span class="re3">$acl</span><span class="br0">&#41;</span></p><p><span class="co1"># Now set the required Value</span><br /> <span class="re3">$regKey</span>.<span class="me1">SetValue</span><span class="br0">&#40;</span><span class="re3">$valueName</span>, <span class="re3">$value</span><span class="br0">&#41;</span></p><p><span class="co1"># Close the key</span><br /> <span class="re3">$regKey</span>.<span class="me1">Close</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div> ]]></content:encoded> <wfw:commentRss>http://www.remkoweijnen.nl/blog/2011/01/28/powershell-script-to-raise-citrix-video-memory/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Unattended Installation of IBM System i Access for Windows</title><link>http://www.remkoweijnen.nl/blog/2010/12/24/unattended-installation-of-ibm-system-i-access-for-windows/</link> <comments>http://www.remkoweijnen.nl/blog/2010/12/24/unattended-installation-of-ibm-system-i-access-for-windows/#comments</comments> <pubDate>Fri, 24 Dec 2010 14:52:04 +0000</pubDate> <dc:creator>Remko</dc:creator> <category><![CDATA[Altiris]]></category> <category><![CDATA[script]]></category><guid isPermaLink="false">http://www.remkoweijnen.nl/blog/?p=951</guid> <description><![CDATA[Today I needed to script the installation of IBM System i Access for Windows (formerly called IBM Client Access). With older versions of this client (up to 5.4) you could use the -r (record) installer switch to record the install in a setup.iss file but version 6.1 uses an MSI based installer. IBM offers the [...]]]></description> <content:encoded><![CDATA[<p>Today I needed to script the installation of IBM System i Access for Windows (formerly called IBM Client Access).</p><p>With older versions of this client (up to 5.4) you could use the -r (record) installer switch to record the install in a setup.iss file but version 6.1 uses an MSI based installer.</p><p>IBM offers the client in a 2 DVD download but you probably only need the first dvd (dvd 1 has both the x86 and x64 installers, dvd 2 has the ia64 installer) which is a whopping 3,5 GB download.</p><p>Inside the download (a zip) is an iso file of which you will only need the files in the root and the Image32 or Image64a folder.</p><p>Inside the image folder are subfolders names MRI29xx where xx is a language identifier:</p><p>The following Identifiers are used:<span id="more-951"></span></p><blockquote><p>MRI2912 &#8211; Croatian<br /> MRI2922 &#8211; Portuguese<br /> MRI2923 &#8211; Dutch Netherlands<br /> MRI2924 &#8211; English<br /> MRI2925 &#8211; Finnish<br /> MRI2926 &#8211; Danish<br /> MRI2928 &#8211; French<br /> MRI2929 &#8211; German<br /> MRI2930 &#8211; Japanese<br /> MRI2931 &#8211; Spanish<br /> MRI2932 &#8211; Italian<br /> MRI2933 &#8211; Norwegian<br /> MRI2937 &#8211; Swedish<br /> MRI2938 &#8211; English Uppercase DBCS<br /> MRI2939 &#8211; German Multinational<br /> MRI2940 &#8211; French Multinational<br /> MRI2942 &#8211; Italian Multinational<br /> MRI2954 &#8211; Arabic<br /> MRI2956 &#8211; Turkish<br /> MRI2957 &#8211; Greek<br /> MRI2961 &#8211; Hebrew<br /> MRI2962 &#8211; Japanese (5026)<br /> MRI2963 &#8211; Belgian Dutch Multinational<br /> MRI2966 &#8211; Belgian French Multinational<br /> MRI2975 &#8211; Czech<br /> MRI2976 &#8211; Hungarian<br /> MRI2978 &#8211; Polish<br /> MRI2979 &#8211; Russian<br /> MRI2980 &#8211; Brazilian Portuguese<br /> MRI2981 &#8211; Canadian French Multinational<br /> MRI2984 &#8211; English DBCS<br /> MRI2986 &#8211; Korean DBCS (KS)<br /> MRI2987 &#8211; Traditional Chinese DBCS<br /> MRI2989 &#8211; Simplified Chinese DBCS (GB)<br /> MRI2992 &#8211; Romanian<br /> MRI2994 &#8211; Slovakian<br /> MRI2996 &#8211; Portuguese Multinational</p></blockquote><p>So if you need to transfer the installer over a slow connection you only need to transfer the language(s) you require.</p><p>To set the language you can use the CWBPRIMARYLANG property to set the language eg CWBPRIMARYLANG=Mri2923 and the /v switch can be used to pass MSI Public properties to the installer.</p><p>Note that the installer requires a reboot so you may want to add REBOOT=ReallySupress to prevent this.</p><p>I use <a  title="Master Return Codes in Altiris" href="http://www.remkoweijnen.nl/blog/2010/12/24/master-return-codes-in-altiris/">Master Return Codes</a> for this in Altiris.</p><p>This the Altiris Job I use:</p><div class="dean_ch" style="white-space: wrap;"> rem Install iSeries Access for Windows V6R1</p><p>set JOBFOLDER=%#*&quot;SELECT dbo.GetActiveFullPath(%ID%)&quot;%<br /> if not exist %JOBFOLDER% MD %JOBFOLDER%</p><p>set InstallPath=%SRCPATH%\PKG\iSeriesAccessV6R1</p><p>rem Jump to the Directory of this Job (you can write logfiles there)<br /> pushd &quot;%JOBFOLDER%&quot;</p><p>rem Start Script Here<br /> rem IBM Docs public properties: http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/rzaij/rzaijwhatsnew.htm<br /> &quot;%InstallPath%\setup.exe&quot; /s /v&quot;/Qb- CWBPRIMARYLANG=Mri2923 INSTALLDIR=\&quot;D:\Apps\IBM\Client Access\&quot; REBOOT=ReallySuppress ALLUSERS=2 /liewa \&quot;%JOBFOLDER%\%JOBNAME%-%computername%.log\&quot;&quot;</p><p>rem Save ErrorLevel<br /> set ret=%errorlevel%</p><p>rem Script End<br /> :EXIT</p><p>rem Return to Start Directory<br /> popd</p><p>rem Exit and return Saved ErrorLevel<br /> pause<br /> exit %ret%<br /> &nbsp;</div><p>IBM References:</p><ul><li><div><a  title="Public Properties" href="http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/rzaij/rzaijpblcprop.htm" target="_blank">Public Properties</a></div></li><li><div><a  title="Defining the level of user interface throughout the installation" href="http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/rzaij/rzaigdfnlvlusriface.htm" target="_blank">Defining the level of user interface throughout the installation</a></div></li><li><div><a  title="Using command line parameters to change the installation behaviour" href="http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/rzaij/rzaijspecfeatetc.htm" target="_blank">Using command line parameters to change the installation behaviour</a></div></li></ul><p>Other references:</p><ul><li><div><a  title="SQL Query to get the Full Path of an Altiris Job" href="http://www.remkoweijnen.nl/blog/2010/12/12/sql-query-to-get-the-full-path-of-an-altiris-job-3/">SQL Query to get the Full Path of an Altiris Job</a></div></li><li><div><a  title="Using Master Return Codes in Altiris" href="http://www.remkoweijnen.nl/blog/2010/12/24/master-return-codes-in-altiris/">Using Master Return Codes in Altiris</a></div></li></ul> ]]></content:encoded> <wfw:commentRss>http://www.remkoweijnen.nl/blog/2010/12/24/unattended-installation-of-ibm-system-i-access-for-windows/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Packaging an application – Auto Accept the EULA</title><link>http://www.remkoweijnen.nl/blog/2010/12/17/packaging-an-application-auto-accept-the-eula/</link> <comments>http://www.remkoweijnen.nl/blog/2010/12/17/packaging-an-application-auto-accept-the-eula/#comments</comments> <pubDate>Fri, 17 Dec 2010 16:10:03 +0000</pubDate> <dc:creator>Remko</dc:creator> <category><![CDATA[Packaging]]></category> <category><![CDATA[PowerShell]]></category> <category><![CDATA[script]]></category> <category><![CDATA[Unattended Installation]]></category><guid isPermaLink="false">http://www.remkoweijnen.nl/blog/?p=879</guid> <description><![CDATA[Yesterday I was packaging an application called Kluwer Juridische Bibliotheek. When the user first starts this application a screen with the License Conditions pops up and it must be accepted: I always try to remove such things as I don&#8217;t think it&#8217;s necessary for every user to accept it. So I took the usual approach [...]]]></description> <content:encoded><![CDATA[<p>Yesterday I was packaging an application called Kluwer Juridische Bibliotheek. When the user first starts this application a screen with the License Conditions pops up and it must be accepted:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2010/12/kluwereula.png" class="thickbox no_icon" rel="gallery-879" title="KluwerEULA"><img src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2010/12/kluwereula-small.png" alt="KluwerEULA" width="430" height="399" /></a></p><p>I always try to remove such things as I don&#8217;t think it&#8217;s necessary for every user to accept it.</p><p><span id="more-879"></span>So I took the usual approach and used Process Monitor to see where acceptance of this agreement is recorded.</p><p>This application creates at file called CMUSER.CFG in the Start Directory of the Application. It&#8217;s a binary file of 276 bytes, probably some kind of struct/record written to a file.</p><p>I inspected it with an Hex Editor and looked for a byte with the value 1 (the ordinal value of a Boolean) and there were only two.</p><p>One of them was followed by three times 00:<br /> <a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2010/12/hexdump.png" class="thickbox no_icon" rel="gallery-879" title="HexDump"><img src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2010/12/hexdump-small.png" alt="HexDump" width="430" height="263" /></a><br /> This is the most likely suspect because often struct/record members are aligned on 4 byte boundaries or a Boolean type is 4 byte.</p><p>I verified this by changing it to 0 and then the EULA is shown again.</p><p>I decided to add this to the login script because it&#8217;s very little effort to do so (I use a very clever login script). I just need to make a folder with the application&#8217;s group name in the groups subfolder and place any script in there.</p><p>The logonscript knows that it only has to inspect this folder if the user is a member of this group and knows how to handle different file types (eg a reg file is imported but a vbs or ps1 file is executed).</p><p>In my case I created a PowerShell file because I can embed a byte dump of the CMUSER.CFG file in it:</p><div class="dean_ch" style="white-space: wrap;"><span class="re3">$KluwerFolder</span> = <span class="st0">&quot;H:\Kluwer&quot;</span><br /> <span class="kw1">if</span> <span class="br0">&#40;</span>!<span class="br0">&#40;</span><span class="re0">Test-<span class="re1">Path</span></span> <span class="re3">$KluwerFolder</span><span class="br0">&#41;</span><span class="br0">&#41;</span><br /> <span class="br0">&#123;</span><br /> &nbsp; &nbsp;<span class="co1"># This is just a Bytedump of the file CMWIN.CFG</span><br /> &nbsp; &nbsp;<span class="co1"># eg $ByteDump = get-content -encoding byte -path &quot;CMWIN.CFG&quot;</span><br /> &nbsp; &nbsp;<span class="re3">$ByteDump</span> = <span class="re4"><span class="br0">&#91;</span><span class="kw3">byte</span><span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#93;</span></span><span class="br0">&#40;</span><br /> &nbsp; &nbsp;&nbsp; &nbsp;<span class="nu0">220</span>,<span class="nu0">118</span>,<span class="nu0">102</span>,<span class="nu0">103</span>,<span class="nu0">20</span>,<span class="nu0">0</span>,<span class="nu0">2</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">54</span>,<span class="nu0">2</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">8</span>,<span class="nu0">0</span>,<span class="nu0">74</span>,<span class="nu0">66</span>,<span class="nu0">52</span>,<span class="nu0">0</span>,<span class="nu0">19</span>,<span class="nu0">0</span>,<span class="nu0">8</span>,<span class="nu0">0</span>,<br /> &nbsp; &nbsp;&nbsp; &nbsp;<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">20</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<br /> &nbsp; &nbsp;&nbsp; &nbsp;<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<br /> &nbsp; &nbsp;&nbsp; &nbsp;<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<br /> &nbsp; &nbsp;&nbsp; &nbsp;<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<br /> &nbsp; &nbsp;&nbsp; &nbsp;<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<br /> &nbsp; &nbsp;&nbsp; &nbsp;<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<br /> &nbsp; &nbsp;&nbsp; &nbsp;<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">195</span>,<span class="nu0">83</span>,<span class="nu0">118</span>,<span class="nu0">55</span>,<span class="nu0">1</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">5</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">64</span>,<span class="nu0">1</span>,<span class="nu0">0</span>,<br /> &nbsp; &nbsp;&nbsp; &nbsp;<span class="nu0">0</span>,<span class="nu0">58</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">72</span>,<span class="nu0">5</span>,<span class="nu0">0</span>,<span class="nu0">0</span>,<span class="nu0">66</span>,<span class="nu0">3</span>,<span class="nu0">0</span>,<span class="nu0">0</span><span class="br0">&#41;</span><br /> &nbsp; &nbsp;<span class="re0">New-<span class="re1">Item</span></span> <span class="re2">-Path</span> <span class="re3">$KluwerFolder</span> <span class="re2">-type</span> Directory <span class="re2">-Force</span> <span class="re2">-Verbose</span><br /> &nbsp; &nbsp;<span class="re0">Set-<span class="re1">Content</span></span> <span class="re2">-Encoding</span> <span class="kw3">Byte</span> <span class="re2">-Path</span> <span class="st0">&quot;$KluwerFolder\CMWIN.CFG&quot;</span> <span class="re2">-Value</span> <span class="re3">$ByteDump</span><br /> <span class="br0">&#125;</span></div> ]]></content:encoded> <wfw:commentRss>http://www.remkoweijnen.nl/blog/2010/12/17/packaging-an-application-auto-accept-the-eula/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Writing Environment  Variables to the Registry from a Script</title><link>http://www.remkoweijnen.nl/blog/2010/12/13/writing-environment-variables-to-the-registry-from-a-script/</link> <comments>http://www.remkoweijnen.nl/blog/2010/12/13/writing-environment-variables-to-the-registry-from-a-script/#comments</comments> <pubDate>Mon, 13 Dec 2010 19:52:59 +0000</pubDate> <dc:creator>Remko</dc:creator> <category><![CDATA[Altiris]]></category> <category><![CDATA[Citrix]]></category> <category><![CDATA[PowerShell]]></category> <category><![CDATA[script]]></category> <category><![CDATA[Terminal Server]]></category><guid isPermaLink="false">http://www.remkoweijnen.nl/blog/?p=856</guid> <description><![CDATA[I usually change the text below the &#8220;This Computer&#8221; icon to reflect the current username and servername: This is an ancient trick, just set the the LocalizedString Value of the following key: HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D} to &#8220;%USERNAME% on %COMPUTERNAME%&#8221;. It get&#8217;s a little more complicated if you want to set this from a script, because the environment [...]]]></description> <content:encoded><![CDATA[<p>I usually change the text below the &#8220;This Computer&#8221; icon to reflect the current username and servername:</p><p><img src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2010/12/useroncomputer.png" alt="UserOnComputer" width="86" height="83" /></p><p>This is an ancient trick, just set the the <em>LocalizedString</em> Value of the following key:</p><div class="dean_ch" style="white-space: wrap;">HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}</div><p>to &#8220;%USERNAME% on %COMPUTERNAME%&#8221;.</p><p>It get&#8217;s a little more complicated if you want to set this from a script, because the environment variables are replaced with the actual value BEFORE they are entered in the Registry.</p><p><span id="more-856"></span>So I always did this with a small VBScript but I figured we should be able to do it with a simple oneliner.</p><p>I first tried the Reg command because the help describes that you can use the caret sign (^) and even gives an example:</p><div class="dean_ch" style="white-space: wrap;">REG ADD HKLM\Software\MyCo /v Path /t REG_EXPAND_SZ /d ^%systemroot^%</div><p>It actually works if we do this:</p><div class="dean_ch" style="white-space: wrap;">REG ADD HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D} /v LocalizedString /t REG_EXPAND_SZ /d ^%USERNAME^%</div><p>But it fails if we try this:</p><div class="dean_ch" style="white-space: wrap;">REG ADD HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D} /v LocalizedString /t REG_EXPAND_SZ /d &quot;^%USERNAME^% on ^%COMPUTERNAME^%&quot;</div><p>My next try was to do it in PowerShell but if using the &#8220;&amp; {&lt;command&gt;}&#8221; syntax it fails because of the same reason.</p><p>So I came up with the following code:</p><div class="dean_ch" style="white-space: wrap;"><span class="kw4">Set</span> TEXT=@USERNAME@ OP @COMPUTERNAME@<br /> <span class="kw3">powershell</span>.<span class="me1">exe</span> <span class="st0">&quot;&amp;amp; {Set-ItemProperty -path &#8216;HKLM:Software\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}&#8217; -name LocalizedString -value (&#8216;%TEXT%&#8217; -replace &#8216;@&#8217;,[char]0&#215;25)}&quot;</span></div><p>Basically I use an environment var to set a readable string where the % sign is replaced by the @ sign.</p><p>And in the PowerShell statement I use the -replace operator to replace the @ with a % again.</p><p>I used [char]0&#215;25 (0&#215;25 is the Hex value of the ASCII code for %) because a single % sign is removed in a bat file.</p><p>Basically I use an environment var to set a readable string where the % sign is replaced by the @ sign.</p><p>And in the PowerShell statement I use the -replace operator to replace the @ with a % again.</p><p>I used [char]0&#215;25 (0&#215;25 is the Hex value of the ASCII code for %) because a single % sign is removed in a bat file.</p> ]]></content:encoded> <wfw:commentRss>http://www.remkoweijnen.nl/blog/2010/12/13/writing-environment-variables-to-the-registry-from-a-script/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
