<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>PowerShell on Remko's Blog</title><link>https://remkoweijnen.nl/blog/tags/powershell/</link><description>Recent content in PowerShell on Remko's Blog</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 16 Jan 2018 14:55:51 +0000</lastBuildDate><atom:link href="https://remkoweijnen.nl/blog/tags/powershell/index.xml" rel="self" type="application/rss+xml"/><item><title>How to use a comma in the Publisher field when using the Desktop App Converter</title><link>https://remkoweijnen.nl/blog/2018/01/16/use-comma-publisher-field-using-desktop-app-converter/</link><pubDate>Tue, 16 Jan 2018 14:55:51 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2018/01/16/use-comma-publisher-field-using-desktop-app-converter/</guid><description>&lt;p&gt;&lt;img style="margin: 0px 7px 0px 0px; float: left; display: inline;" src="https://docs.microsoft.com/en-us/windows/uwp/porting/images/desktop-to-uwp/dac.png" alt="DAC Icon" width="73" height="73" align="left" /&gt;When using the Desktop App Converter there&amp;rsquo;s no need to sign the resulting .appx packages with your own code signing certificate when you submit them to the Store.&lt;/p&gt;
&lt;p&gt;However if you want to test the package on a different machine or distribute it to test users you may want to sign the .appx with a certificate.&lt;/p&gt;
&lt;p&gt;One option is to use the &lt;code&gt;-sign&lt;/code&gt; parameter, in this case the Desktop App Converter generates a code signing certificate and signs the package with it. Although easy to use, it&amp;rsquo;s not very convenient if you want to distribute the .appx as you need to add the certificate to the &lt;code&gt;Trusted People&lt;/code&gt; certificates store (for each user). See &lt;a href="https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter#run-app" target="_blank" rel="noopener"&gt;Run the Packaged App&lt;/a&gt; in the documentation.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2018/01/image-1.webp" class="glightbox" data-type="image" data-gallery="post-4243"&gt;&lt;img loading="lazy" decoding="async" style="margin: 0px 3px 0px 0px; float: right; display: inline;" title="image" src="https://remkoweijnen.nl/blog/wp-content/uploads/2018/01/image_thumb-1.webp" alt="image" width="95" height="95" align="right" /&gt;&lt;/a&gt;If you want to sign the .appx package with a trusted certificate (e.g. issued by a trusted certificate authority such as &lt;a href="https://www.digicert.com/code-signing/" target="_blank" rel="noopener"&gt;DigiCert&lt;/a&gt;) you need to make sure that you pass the subject (the CN) from your code signing certificate to the Desktop App Converter (using the &lt;code&gt;-Publisher&lt;/code&gt; parameter).&lt;/p&gt;</description></item><item><title>Sign APPX packages with PowerShell</title><link>https://remkoweijnen.nl/blog/2017/12/20/sign-appx-packages-powershell/</link><pubDate>Wed, 20 Dec 2017 15:00:33 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2017/12/20/sign-appx-packages-powershell/</guid><description>&lt;p&gt;I have been working with Microsoft&amp;rsquo;s Desktop App Converter a lot recently. Even though there&amp;rsquo;s an option to autosign the resulting package with the &lt;code&gt;-Sign&lt;/code&gt; switch I prefer to sign APPX packages myself using signtool.&lt;/p&gt;
&lt;p&gt;The reason is that I can send UWP packages to testers for sideloading without requiring them to import the auto generated certificate (which is different on each (re)build).&lt;/p&gt;
&lt;p&gt;However I always forget the exact path to signtool.exe (this comes with the &lt;a href="https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk" target="_blank" rel="noopener"&gt;Windows SDK&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;The Windows 10 SDK is installed by default in &lt;code&gt;C:\Program Files (x86)\Windows Kits\10&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Signtool.exe will be in the folder &lt;code&gt;&amp;lt;sdkpath&amp;gt;\bin\&amp;lt;version&amp;gt;\&amp;lt;platform&amp;gt;\signtool.exe&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;As there are multiple version of Windows 10 there are multiple version of the SDK and you can install those concurrently.&lt;/p&gt;
&lt;p&gt;But then I found the PowerShell cmdlet &lt;a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/resolve-path?view=powershell-3.0" target="_blank" rel="noopener"&gt;Resolve-Path&lt;/a&gt; which &amp;ldquo;Resolves the wildcard characters in a path, and displays the path contents&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;This does exactly what I need:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2017/12/image-5.webp" class="glightbox" data-type="image" data-gallery="post-4204"&gt;&lt;img loading="lazy" decoding="async" style="display: inline;" title="image" src="https://remkoweijnen.nl/blog/wp-content/uploads/2017/12/image_thumb-5.webp" alt="image" width="433" height="83" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Wow, Resolve-Path is a perfect example of the many hidden gems in PowerShell!&lt;/p&gt;
&lt;p&gt;So I decided to wrap signtool.exe in a PowerShell cmdlet as PowerShell also makes it easy to locate the correct code signing certificate from the certificate store.&lt;/p&gt;</description></item><item><title>Get Windows 10 Version Number with PowerShell</title><link>https://remkoweijnen.nl/blog/2017/04/04/get-windows-10-version-number-powershell/</link><pubDate>Tue, 04 Apr 2017 16:54:02 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2017/04/04/get-windows-10-version-number-powershell/</guid><description>&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2017/04/image.webp" class="glightbox" data-type="image" data-gallery="post-4133"&gt;&lt;img loading="lazy" decoding="async" style="float: right; margin: 0px 0px 0px 3px; display: inline;" title="image" src="https://remkoweijnen.nl/blog/wp-content/uploads/2017/04/image_thumb.webp" alt="image" width="119" height="103" align="right" /&gt;&lt;/a&gt;As you may heard, the API&amp;rsquo;s returning the Operating System version have &lt;a href="https://msdn.microsoft.com/windows/compatibility/operating-system-version-changes-in-windows-8-1"&gt;changed&lt;/a&gt;, started with Windows 8.1 and Server 2012 R2.&lt;/p&gt;
&lt;p&gt;The reason for this change is Application Compatibility but let&amp;rsquo;s take a little closer look into this why.&lt;/p&gt;
&lt;p&gt;As an application developer there may be a need to check the version of the OS you&amp;rsquo;re running on. A typical example is when you are using an API that only works on a specific Windows version (and up). Or the other round, you&amp;rsquo;re not supporting an older version of Windows (say Windows XP as an example).&lt;/p&gt;
&lt;p&gt;A common error in such version checks is to check for a specific Windows version but forget to take new (not yet released) versions into account.&lt;/p&gt;</description></item><item><title>Split a string by dollar sign ($) in PowerShell</title><link>https://remkoweijnen.nl/blog/2017/03/13/split-string-dollar-sign-powershell/</link><pubDate>Mon, 13 Mar 2017 15:28:13 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2017/03/13/split-string-dollar-sign-powershell/</guid><description>&lt;p&gt;Just a very quick post (more like a note to self) but I wanted to split a string with the $ sign in PowerShell:&lt;/p&gt;
&lt;div class="codecard"&gt;
 &lt;div class="codehead"&gt;
 &lt;span class="codefile"&gt;&lt;/span&gt;
 &lt;span class="codetools" data-pagefind-ignore&gt;
 &lt;span class="codelang"&gt;powershell&lt;/span&gt;
 &lt;button class="codebtn" type="button" data-copy&gt;Copy&lt;/button&gt;
 &lt;a class="codebtn" download=".ps1" href="data:text/plain;charset=utf-8;base64,J29uZSR0d28kdGhyZWUkZm91ciRmaXZlJyAtc3BsaXQgJyQn"&gt;Download&lt;/a&gt;
 &lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="codebody"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt;&amp;#39;one$two$three$four$five&amp;#39;&lt;/span&gt; &lt;span class="n"&gt;-split&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;$&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Took me a little while to realize that this doesn&amp;rsquo;t work as the &lt;a href="https://msdn.microsoft.com/en-us/powershell/reference/3.0/microsoft.powershell.core/about/about_split"&gt;split&lt;/a&gt; operator in Windows PowerShell uses a regular expression in the delimiter, rather than a simple character.&lt;/p&gt;</description></item><item><title>Upload ovf/ova to vCloud Director with PowerShell</title><link>https://remkoweijnen.nl/blog/2015/10/14/upload-ovfova-to-vcloud-director-with-powershell/</link><pubDate>Wed, 14 Oct 2015 10:08:49 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2015/10/14/upload-ovfova-to-vcloud-director-with-powershell/</guid><description>&lt;p&gt;Recently support for NPAPI has been &lt;a href="https://support.google.com/chrome/answer/6213033?hl=en"&gt;removed&lt;/a&gt; from Google Chrome. While understandable from a security point of view it does mean that some plugins no longer work.&lt;/p&gt; &lt;p&gt;A good example is VMware's Client Integration Plugin where we've lost the ability to upload an ovf template. While VMware has published a fix for vCenter (see &lt;a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;amp;cmd=displayKC&amp;amp;externalId=2130672"&gt;this kb&lt;/a&gt;), it has not been fixed for vCloud Director:&lt;/p&gt; &lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2015/10/image7.webp" class="glightbox" data-type="image" data-gallery="post-3620"&gt;&lt;img loading="lazy" decoding="async" title="Browser Compatiblity Warning" style="display: inline" alt="The attempted operation cannot be performed using this browser. Re-try using an alternative method:&amp;#10;&amp;#10;- Use the VMware OVF Tool to perform the operation. You can download the OVF Tool and its User Guide from the OVF Tool product page at https://www.vmware.com/support/developer/ovf/.&amp;#10;- Use a browser and platform combination that is supported by vCloud Director for this operation. For the supported browser and platform combinations, see the Release Notes for this version of vCloud Director." src="https://remkoweijnen.nl/blog/wp-content/uploads/2015/10/image_thumb7.webp" width="326" height="204" /&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Deploy VCSA 6 to vCloud Director or vCloud Air</title><link>https://remkoweijnen.nl/blog/2015/10/05/deploy-vcsa-6-to-vcloud-director-or-vcloud-air/</link><pubDate>Mon, 05 Oct 2015 20:11:47 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2015/10/05/deploy-vcsa-6-to-vcloud-director-or-vcloud-air/</guid><description>&lt;p&gt;In versions prior to 6.0 VMware supplied the VCSA (vCenter Server Appliance) as an OVF template that could be imported directly.&lt;/p&gt; &lt;p&gt;Starting with version 6.0 the installation process has changed and now consist of an .iso file containing a custom, HTML based, installer. Vladan Seget has a nice &lt;a href="http://www.vladan.fr/install-vmware-vcsa-6-0/"&gt;blog post&lt;/a&gt; where he describes the installation.&lt;/p&gt; &lt;p&gt;This installation process is annoying, it needs a separate client (Windows) machine to run the installer on, requires the Client Integration Plugin (which doesn't appear to run well on chrome now that support for npapi/dpapi has been removed):&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2015/10/image.webp"&gt; &lt;br /&gt;&lt;img loading="lazy" decoding="async" title="Wheb prompted, allow access to the Client Integration Plugin" style="margin: 4px 0px; display: inline" alt="Please install the Client Integration Plugin 6.0 provided in the vCenter Server Appliance ISO image (requires quitting the browser)" src="https://remkoweijnen.nl/blog/wp-content/uploads/2015/10/image_thumb.webp" width="417" height="37" /&gt;&lt;/a&gt; &lt;br /&gt;But even worse is that we cannot import VCSA 6.0 in vCloud Director. Even converting the OVF inside the iso file doesn't help because vCloud directory lacks support for Deployment Options. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Synchronizing Citrix ShareFile with PowerShell</title><link>https://remkoweijnen.nl/blog/2015/01/28/synchronizing-citrix-sharefile-with-powershell/</link><pubDate>Wed, 28 Jan 2015 11:39:17 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2015/01/28/synchronizing-citrix-sharefile-with-powershell/</guid><description>&lt;p&gt;&lt;a class="glightbox thickbox" href="https://remkoweijnen.nl/blog/wp-content/uploads/2015/01/ShareFileLogo.gif" data-type="image" data-gallery="post-3555"&gt;&lt;img loading="lazy" decoding="async" title="ShareFileLogo" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: right; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="ShareFileLogo" src="https://remkoweijnen.nl/blog/wp-content/uploads/2015/01/ShareFileLogo_thumb.gif" width="64" align="right" height="64" /&gt;&lt;/a&gt;The Citrix ShareFile Sync application is quite limited in functionality, one of those limitations is that you can only synchronize to a single (one) local folder.&lt;/p&gt; &lt;p&gt;As Helge Klein wrote in his excellent article &amp;quot;&lt;a href="https://helgeklein.com/blog/2014/01/configuring-citrix-sharefile-sync-powershell/"&gt;Configuring Citrix ShareFile Sync from PowerShell&lt;/a&gt;&amp;quot; this is simply a GUI restriction and not a restriction in the actual ShareFile sync engine.&lt;/p&gt; &lt;p&gt;Helge describes that you can easily do this in PowerShell with the following example:&lt;/p&gt; 
&lt;div class="codecard"&gt;
 &lt;div class="codehead"&gt;
 &lt;span class="codefile"&gt;Add-SyncJob example&lt;/span&gt;
 &lt;span class="codetools" data-pagefind-ignore&gt;
 &lt;span class="codelang"&gt;powershell&lt;/span&gt;
 &lt;button class="codebtn" type="button" data-copy&gt;Copy&lt;/button&gt;
 &lt;a class="codebtn" download="add-syncjob-example.ps1" href="data:text/plain;charset=utf-8;base64,QWRkLVN5bmNKb2IgLUFwcGxpY2F0aW9uSWQgMSAtQXBwbGljYXRpb25OYW1lICJQb3dlclNoZWxsIiAtQWNjb3VudCBoZWxnZWtsZWluLnNoYXJlZmlsZS5jb20KLVJlbW90ZUZvbGRlck5hbWUgImZvYzg2YzE5LWQ5MDQtNDM0YS05ZDY3LXh4eHh4eHh4eHh4eCIgLUxvY2FsRm9sZGVyUGF0aCAiRDpcRGF0ZW5cU3luYyB0byBTaGFyZUZpbGUiCi1BdXRoVHlwZSA0IC1Vc2VyTmFtZSB4eHh4eHhAaGVsZ2VrbGVpbi5jb20gLVN5bmNEaXJlY3Rpb24gMiAtUGFzc3dvcmQgIk1ZIFNIQVJFRklMRSBQQVNTV09SRCI="&gt;Download&lt;/a&gt;
 &lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="codebody"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;Add-SyncJob&lt;/span&gt; &lt;span class="n"&gt;-ApplicationId&lt;/span&gt; &lt;span class="mf"&gt;1&lt;/span&gt; &lt;span class="n"&gt;-ApplicationName&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;PowerShell&amp;#34;&lt;/span&gt; &lt;span class="n"&gt;-Account&lt;/span&gt; &lt;span class="n"&gt;helgeklein&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;sharefile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;com&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;-RemoteFolderName&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;foc86c19-d904-434a-9d67-xxxxxxxxxxxx&amp;#34;&lt;/span&gt; &lt;span class="n"&gt;-LocalFolderPath&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;D:\Daten\Sync to ShareFile&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;-AuthType&lt;/span&gt; &lt;span class="mf"&gt;4&lt;/span&gt; &lt;span class="n"&gt;-UserName&lt;/span&gt; &lt;span class="n"&gt;xxxxxx&lt;/span&gt;&lt;span class="nv"&gt;@helgeklein&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;com&lt;/span&gt; &lt;span class="n"&gt;-SyncDirection&lt;/span&gt; &lt;span class="mf"&gt;2&lt;/span&gt; &lt;span class="n"&gt;-Password&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;MY SHAREFILE PASSWORD&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;While the command was accepted, nothing was synchronized.&lt;/p&gt;</description></item><item><title>Handling ini files in PowerShell</title><link>https://remkoweijnen.nl/blog/2014/07/29/handling-ini-files-powershell/</link><pubDate>Tue, 29 Jul 2014 15:03:08 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2014/07/29/handling-ini-files-powershell/</guid><description>&lt;p&gt;&lt;img title="Ini File" style="float: right; margin: 0px 0px 20px; display: inline" alt="Ini File Icon" src="http://www.fileinfo.com/images/icons/files/128/ini-41.png" width="60" align="right" height="60" /&gt;This morning Aaron Parker was wondering if Hash Tables could be used to work with ini files:&lt;/p&gt; &lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2014/07/image8.webp" class="glightbox thickbox" data-type="image" data-gallery="post-3527"&gt;&lt;img loading="lazy" decoding="async" title="Aaron Parker | Twitter | @stealthpuppy" style="display: inline" alt="Aaron Parker | @stealthpuppy | @remkoweijnen @msh_dave need to see if this approach works for editing INI files" src="https://remkoweijnen.nl/blog/wp-content/uploads/2014/07/image_thumb8.webp" width="320" height="132" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;I thought it was a great idea because in Hash Tables you can use the . operator to get or set a Hash Table entry. But I wondered what to do with sections in ini files. Then I got the idea to use nested Hash Tables for that.&lt;/p&gt; &lt;p&gt;The result is two functions, one to read an ini file into a nested Hash Table and one function to write it back to an ini file.&lt;/p&gt;</description></item><item><title>Sorting a hashtable by byte value in PowerShell</title><link>https://remkoweijnen.nl/blog/2014/07/22/sorting-hashtable-byte-value-powershell/</link><pubDate>Tue, 22 Jul 2014 12:03:28 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2014/07/22/sorting-hashtable-byte-value-powershell/</guid><description>&lt;p&gt;&lt;img style="float: right; display: inline" src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTEtkV3oLDtyNhyD55yu4uoWbX_oIrnDuJDl4NK6zC59MPNHCnynsqZ9yae" width="96" align="right" height="96" /&gt;In a PowerShell script I needed to sort a hash table by byte value (not alphabetically, lowercase parameters will be listed after uppercase ones). An example for this requirement is the &lt;a href="http://docs.aws.amazon.com/AWSECommerceService/latest/DG/rest-signature.html" target="_blank"&gt;Amazon Product Advertising API&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Consider the following hashtable as an example:&lt;/p&gt; 
&lt;div class="codecard"&gt;
 &lt;div class="codehead"&gt;
 &lt;span class="codefile"&gt;Example Hash Table&lt;/span&gt;
 &lt;span class="codetools" data-pagefind-ignore&gt;
 &lt;span class="codelang"&gt;powershell&lt;/span&gt;
 &lt;button class="codebtn" type="button" data-copy&gt;Copy&lt;/button&gt;
 &lt;a class="codebtn" download="example-hash-table.ps1" href="data:text/plain;charset=utf-8;base64,JHBhcmFtcyA9IEB7fQokcGFyYW1zLkFkZCgiQXNzb2NpYXRlVGFnIiwgImR1bW15IikKJHBhcmFtcy5BZGQoIkFXU0FjY2Vzc0tleUlkIiwgIkFLSUFJT1NGT0ROTjdFWEFNUExFIikKJHBhcmFtcy5BZGQoIklkVHlwZSIsICIwNjc5NzIyNzY5IikKJHBhcmFtcy5BZGQoIk9wZXJhdGlvbiIsICJJdGVtTG9va3VwIik="&gt;Download&lt;/a&gt;
 &lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="codebody"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$params&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="vm"&gt;@&lt;/span&gt;&lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;AssociateTag&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;dummy&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;AWSAccessKeyId&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;AKIAIOSFODNN7EXAMPLE&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;IdType&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;0679722769&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Operation&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;ItemLookup&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If we use the Sort-Object to order the list (note that we need to use the &lt;a href="http://technet.microsoft.com/en-us/library/ee692803.aspx" target="_blank"&gt;GetEnumerator&lt;/a&gt; method):&lt;/p&gt;
&lt;div class="codecard"&gt;
 &lt;div class="codehead"&gt;
 &lt;span class="codefile"&gt;Sort Hash Table&lt;/span&gt;
 &lt;span class="codetools" data-pagefind-ignore&gt;
 &lt;span class="codelang"&gt;powershell&lt;/span&gt;
 &lt;button class="codebtn" type="button" data-copy&gt;Copy&lt;/button&gt;
 &lt;a class="codebtn" download="sort-hash-table.ps1" href="data:text/plain;charset=utf-8;base64,JHBhcmFtcy5HZXRFbnVtZXJhdG9yKCkgfCBTb3J0LU9iamVjdCBOYW1l"&gt;Download&lt;/a&gt;
 &lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="codebody"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;GetEnumerator&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="nb"&gt;Sort-Object&lt;/span&gt; &lt;span class="n"&gt;Name&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;We will get the following result:&lt;/p&gt;
&lt;div class="codecard"&gt;
 &lt;div class="codehead"&gt;
 &lt;span class="codefile"&gt;Sort Results&lt;/span&gt;
 &lt;span class="codetools" data-pagefind-ignore&gt;
 &lt;span class="codelang"&gt;powershell&lt;/span&gt;
 &lt;button class="codebtn" type="button" data-copy&gt;Copy&lt;/button&gt;
 &lt;a class="codebtn" download="sort-results.ps1" href="data:text/plain;charset=utf-8;base64,TmFtZSAgICAgICAgICAgICAgICAgICAgICAgICAgIFZhbHVlCi0tLS0gICAgICAgICAgICAgICAgICAgICAgICAgICAtLS0tLQpBc3NvY2lhdGVUYWcgICAgICAgICAgICAgICAgICAgZHVtbXkKQVdTQWNjZXNzS2V5SWQgICAgICAgICAgICAgICAgIEFLSUFJT1NGT0ROTjdFWEFNUExFCklkVHlwZSAgICAgICAgICAgICAgICAgICAgICAgICAwNjc5NzIyNzY5Ck9wZXJhdGlvbiAgICAgICAgICAgICAgICAgICAgICBJdGVtTG9va3Vw"&gt;Download&lt;/a&gt;
 &lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="codebody"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="n"&gt;Value&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;----&lt;/span&gt; &lt;span class="p"&gt;-----&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;AssociateTag&lt;/span&gt; &lt;span class="n"&gt;dummy&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;AWSAccessKeyId&lt;/span&gt; &lt;span class="n"&gt;AKIAIOSFODNN7EXAMPLE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;IdType&lt;/span&gt; &lt;span class="mf"&gt;0679722769&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;Operation&lt;/span&gt; &lt;span class="n"&gt;ItemLookup&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you use the &lt;code&gt;-CaseSensitive&lt;/code&gt; switch the resulting order will remain the same.&lt;/p&gt;</description></item><item><title>Get Actual CPU Clock Speed with PowerShell</title><link>https://remkoweijnen.nl/blog/2014/07/18/get-actual-cpu-clock-speed-powershell/</link><pubDate>Fri, 18 Jul 2014 16:29:24 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2014/07/18/get-actual-cpu-clock-speed-powershell/</guid><description>&lt;p&gt;To get the best performance out of Virtual Desktops it is essential that the power configuration in the system BIOS and the HyperVisor are configured for maximum performance.&lt;/p&gt; &lt;p&gt;Many people have blogged about the importance of these settings like, &lt;a href="http://blog.atlantiscomputing.com/2013/08/powering-vdi-performance-best-practices-for-optimal-virtual-desktop-performance/" target="_blank"&gt;Andrew Wood&lt;/a&gt;, &lt;a href="http://helgeklein.com/blog/2013/05/the-effects-of-power-savings-mode-on-vcpu-performance/" target="_blank"&gt;Helge Klein&lt;/a&gt; and &lt;a href="http://workinghardinit.wordpress.com/2011/06/20/consider-cpu-power-optimization-versus-performance-when-virtualizing/" target="_blank"&gt;Didier Van Hoye&lt;/a&gt;. So I will not go into details again.&lt;/p&gt; &lt;p&gt;But how do you check from a Virtual Machine if you are actually running at full clock speed or not?&lt;/p&gt; &lt;p&gt;I have written a PowerShell script to do just that (requires at least PowerShell v3).&lt;/p&gt; &lt;p&gt;Here are some screenshots:&lt;/p&gt; &lt;p&gt;Running with &amp;quot;High Performance profile&amp;quot;:&lt;/p&gt; &lt;p&gt;&lt;a class="glightbox thickbox" href="https://remkoweijnen.nl/blog/wp-content/uploads/2014/07/clip_image002.jpg" data-type="image" data-gallery="post-3516"&gt;&lt;img loading="lazy" decoding="async" title="Windows PowerShell" style="display: inline" alt="CPU Clock Speed with d&amp;quot;High Performanced&amp;quot; Power Profile" src="https://remkoweijnen.nl/blog/wp-content/uploads/2014/07/clip_image002_thumb.jpg" width="240" height="74" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Running with &amp;quot;Balanced&amp;quot; power profile:&lt;/p&gt; &lt;p&gt;&lt;a class="glightbox thickbox" href="https://remkoweijnen.nl/blog/wp-content/uploads/2014/07/clip_image0025.jpg" data-type="image" data-gallery="post-3516"&gt;&lt;img loading="lazy" decoding="async" title="Windows PowerShell" style="display: inline" alt="CPU Clock Speed with High Performance Balanced Profile" src="https://remkoweijnen.nl/blog/wp-content/uploads/2014/07/clip_image0025_thumb.jpg" width="240" height="74" /&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Scriptable Citrix Password Encoder</title><link>https://remkoweijnen.nl/blog/2013/03/19/scriptable-citrix-password-encoder/</link><pubDate>Tue, 19 Mar 2013 16:27:49 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2013/03/19/scriptable-citrix-password-encoder/</guid><description>&lt;p&gt;A while ago I &lt;a href="https://remkoweijnen.nl/blog/2012/05/13/encoding-and-decoding-citrix-passwords/"&gt;published&lt;/a&gt; a tool to Encode and Decode Citrix passwords. Today I am publishing a small update to this tool that makes it scriptable by adding a &lt;a href="http://en.wikipedia.org/wiki/Component_Object_Model" target="_blank"&gt;COM interface&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;If you start the tool without parameters you will get the GUI, just like before:&lt;/p&gt; &lt;p&gt;&lt;img loading="lazy" decoding="async" title="Citrix Password Hasher by Remko Weijnen" alt="Encrypt | Decrypt Password | Hash | Citrix | Ctx1" src="https://remkoweijnen.nl/blog/wp-content/uploads/2012/05/image_thumb3.webp" width="419" height="84" /&gt;&lt;/p&gt; &lt;p&gt;To use the COM interface you first need to register the executable with the /regserver switch:&lt;/p&gt; &lt;p&gt;&lt;a class="glightbox thickbox" href="https://remkoweijnen.nl/blog/wp-content/uploads/2013/03/SNAGHTML185eb4ec.webp" data-type="image" data-gallery="post-3152"&gt;&lt;img loading="lazy" decoding="async" style="display: inline" title="Register CtxPass" alt="CtxPass /RegServer" src="https://remkoweijnen.nl/blog/wp-content/uploads/2013/03/SNAGHTML185eb4ec_thumb.webp" width="414" height="64" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;After the registration you can call it using any language that supports COM. To get you started I wrote a few examples&lt;/p&gt;</description></item><item><title>Parse RES Building Blocks with PowerShell</title><link>https://remkoweijnen.nl/blog/2012/12/07/parse-res-building-blocks-with-powershell/</link><pubDate>Fri, 07 Dec 2012 13:29:20 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2012/12/07/parse-res-building-blocks-with-powershell/</guid><description>&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration: underline;"&gt;Background&lt;br&gt;
&lt;/span&gt;&lt;/strong&gt;Customer uses Citrix XenApp 5 with ThinApp, RES Workspace Manager and RES Workspace Extender.&lt;/p&gt;
&lt;p&gt;An application integration strategy is defined, the picture below displays the strategy and preferred order:&lt;/p&gt;
&lt;p&gt;&lt;a class="glightbox thickbox" href="https://remkoweijnen.nl/blog/wp-content/uploads/2012/12/image12.webp" data-type="image" data-gallery="post-2850"&gt;&lt;img loading="lazy" decoding="async" style="display: inline;" title="image" src="https://remkoweijnen.nl/blog/wp-content/uploads/2012/12/image_thumb12.webp" alt="image" width="399" height="136" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration: underline;"&gt;Question&lt;/span&gt;&lt;/strong&gt;&lt;br&gt;
Customer wanted to know the type (1..7) for all applications currently defined in RES Workspace Manager.&lt;/p&gt;
&lt;p&gt;I decided to export all the Applications from RES WM as Building Blocks. This results in a folder with XML files. I decided to parse the XML files with a PowerShell script.&lt;/p&gt;</description></item><item><title>Query Administrator Account Name with PowerShell</title><link>https://remkoweijnen.nl/blog/2012/10/25/query-administrator-account-name-with-powershell/</link><pubDate>Thu, 25 Oct 2012 15:22:47 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2012/10/25/query-administrator-account-name-with-powershell/</guid><description>&lt;p&gt;A customer had partially implemented a (written) policy in the past where the the Local Administrator account was renamed according to a special convention.&lt;/p&gt;
&lt;p&gt;This policy stated that the Administrator account needed to be renamed to admin with the computername as a prefix.&lt;/p&gt;
&lt;p&gt;However they didn&amp;rsquo;t know exactly on which machines this policy had been applied to in the past. I was asked to write a script that would check a list of machine names, query the Administrator account name and write this in a new list.&lt;/p&gt;
&lt;p&gt;The Administrator account has a &lt;a href="http://support.microsoft.com/kb/243330"&gt;Well Known SID&lt;/a&gt; of S-1-5-21-xxxxxxx-500 where xxxxxxx is the SID of the computer.&lt;/p&gt;</description></item><item><title>Bit Shifting in PowerShell</title><link>https://remkoweijnen.nl/blog/2012/05/10/bit-shifting-in-powershell/</link><pubDate>Thu, 10 May 2012 12:14:36 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2012/05/10/bit-shifting-in-powershell/</guid><description>&lt;p&gt;&lt;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" /&gt;I needed to dome some &lt;a href="http://en.wikipedia.org/wiki/Bitwise_operation#Logical_shift"&gt;Bit Shifting&lt;/a&gt; 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.&lt;/p&gt; &lt;p&gt;I didn't want to revert to C# so I implemented shift left and shift right functions in PowerShell.&lt;/p&gt; &lt;p&gt;The code isn'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):&lt;/p&gt;</description></item><item><title>Edit Document requires a Windows SharePoint Services-compatible application</title><link>https://remkoweijnen.nl/blog/2012/03/09/edit-document-requires-a-windows-sharepoint-services-compatible-application/</link><pubDate>Fri, 09 Mar 2012 14:23:11 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2012/03/09/edit-document-requires-a-windows-sharepoint-services-compatible-application/</guid><description>&lt;p&gt;Today I was troubleshooting a message that appeared when a user tries to edit a document from SharePoint on a Citrix XenApp server. &lt;p&gt;The user browsed to a word document on Sharepoint and selected &amp;ldquo;Edit in Microsoft Office Word&amp;rdquo; from the Combobox:&lt;/p&gt; &lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2012/03/image8.webp" class="glightbox" data-type="image" data-gallery="post-2526"&gt;&lt;img loading="lazy" decoding="async" style="display: inline" title="Sharepoint Document Context Menu" alt="Edit in Microsoft Office Word" src="https://remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb8.webp" width="156" height="124" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;This would present the following error message to the user:&lt;/p&gt; &lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2012/03/image9.webp" class="glightbox" data-type="image" data-gallery="post-2526"&gt;&lt;img loading="lazy" decoding="async" style="display: inline" title="Windows Internet Explorer" alt="&amp;#39;Edit Document&amp;#39; requires a Windows SharePoint Services-compatible application and Microsoft Internet Explorer 6.0 or greater." src="https://remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb9.webp" width="415" height="73" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;/p&gt;</description></item><item><title>PowerShell script to read Agent Guid from Automation Manager</title><link>https://remkoweijnen.nl/blog/2012/03/06/powershell-script-to-read-agent-guid-from-automation-manager/</link><pubDate>Tue, 06 Mar 2012 16:00:06 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2012/03/06/powershell-script-to-read-agent-guid-from-automation-manager/</guid><description>&lt;p&gt;From a script I needed to schedule a project in RES Automation Manager 2011 for a particular server.&lt;/p&gt; &lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2012/03/image2.webp" class="glightbox" data-type="image" data-gallery="post-2500"&gt;&lt;img loading="lazy" decoding="async" style="margin: 0px 3px 6px 0px; display: inline; float: left" title="image" alt="image" align="left" src="https://remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb2.webp" width="65" height="65" /&gt;&lt;/a&gt;This can be done with the WMC.exe commandline tool as documented in the &lt;a href="http://support.ressoftware.com/automationmanageradminguide/15833.htm" target="_blank"&gt;Admin Guide&lt;/a&gt;. However we must specify the agent's GUID instead of it's name. We can of course use the AM console to get the agent's GUID but it's more flexible to script this.&lt;/p&gt; &lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2012/03/image3.webp" class="glightbox" data-type="image" data-gallery="post-2500"&gt;&lt;img loading="lazy" decoding="async" style="display: inline; float: right" title="image" alt="image" align="right" src="https://remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb3.webp" width="78" height="121" /&gt;&lt;/a&gt;Unfortunately there's no API we can call so I am directly quering the AM database using a PowerShell script.&lt;/p&gt; &lt;p&gt;The script read the database server and database name from the registry so it assumes you have the AM console installed.&lt;/p&gt;</description></item><item><title>PowerShell RegEx Fun</title><link>https://remkoweijnen.nl/blog/2012/03/06/powershell-regex-fun/</link><pubDate>Tue, 06 Mar 2012 11:19:53 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2012/03/06/powershell-regex-fun/</guid><description>&lt;p&gt;I am writing a script that is going to automate a number of manual steps involved in creating a new image with Citrix PVS.&lt;/p&gt; &lt;p&gt;First step is to copy the most recent base image which is kept in a folder structure. The folder name is always YYYY-MM-DD (description): &lt;/p&gt; &lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2012/03/image1.webp" class="glightbox" data-type="image" data-gallery="post-2493"&gt;&lt;img loading="lazy" decoding="async" style="display: inline" title="image" alt="image" src="https://remkoweijnen.nl/blog/wp-content/uploads/2012/03/image_thumb1.webp" width="252" height="71" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;I needed to determine the most recent folder and didn't want to rely on creation date. Instead I walk the directory tree and filter the date out of the filename with a regular expression:&lt;/p&gt;</description></item><item><title>Convert MCli output into PowerShell Objects</title><link>https://remkoweijnen.nl/blog/2012/02/29/convert-mcli-output-into-powershell-objects/</link><pubDate>Wed, 29 Feb 2012 21:35:49 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2012/02/29/convert-mcli-output-into-powershell-objects/</guid><description>&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2012/02/image21.webp" class="glightbox" data-type="image" data-gallery="post-2468"&gt;&lt;img loading="lazy" decoding="async" style="display: inline; float: right" title="image" alt="image" align="right" src="https://remkoweijnen.nl/blog/wp-content/uploads/2012/02/image_thumb21.webp" width="83" height="83" /&gt;&lt;/a&gt;I was experimenting today with the PowerShell cmdlets for Citrix Provisioning Server. I was surprised to learn that the output of these cmdlets are not PowerShell types such as collections and objects with methods and properties but just plain text output.&lt;/p&gt; &lt;p&gt;A google search for a method to quickly convert the garbage output to objects led me to &lt;a href="http://www.out-web.net/?p=599" target="_blank"&gt;this blog post&lt;/a&gt; by Frank Peter. He describes a clever use of the switch statement with regular expressions with the Get-DiskInfo cmdlet.&lt;/p&gt; &lt;p&gt;Using Frank's code as a basis I wrote a generic function that converts Mcli output to an array of objects.&lt;/p&gt;</description></item><item><title>Read Maximum Password Age with PowerShell</title><link>https://remkoweijnen.nl/blog/2011/12/02/read-maximum-password-age-with-powershell/</link><pubDate>Fri, 02 Dec 2011 13:47:44 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/12/02/read-maximum-password-age-with-powershell/</guid><description>&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/12/image1.webp" class="glightbox" data-type="image" data-gallery="post-2212"&gt;&lt;img loading="lazy" decoding="async" style="margin: 0px 5px 0px 0px; display: inline; float: left" title="image" alt="image" align="left" src="https://remkoweijnen.nl/blog/wp-content/uploads/2011/12/image_thumb1.webp" width="33" height="39" /&gt;&lt;/a&gt;I needed to read out the Maximum Password age with a PowerShell script in a Windows 2003 domain.&lt;/p&gt; &lt;p&gt;Reading out the &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms676863(v=vs.85).aspx" target="_blank"&gt;maxPwdAge&lt;/a&gt; attribute is a trivial task&amp;#160; in PowerShell (I am re-using the function &lt;a href="https://remkoweijnen.nl/blog/2011/12/01/convert-iadslargeinteger-to-int64-in-powershell/" target="_blank"&gt;AdsLargeIntegerToInt64&lt;/a&gt;):&lt;/p&gt;
&lt;div class="codecard"&gt;
 &lt;div class="codehead"&gt;
 &lt;span class="codefile"&gt;&lt;/span&gt;
 &lt;span class="codetools" data-pagefind-ignore&gt;
 &lt;span class="codelang"&gt;text&lt;/span&gt;
 &lt;button class="codebtn" type="button" data-copy&gt;Copy&lt;/button&gt;
 &lt;a class="codebtn" download=".txt" href="data:text/plain;charset=utf-8;base64,JGRvbWFpbiA9ICBOZXctT2JqZWN0IFN5c3RlbS5EaXJlY3RvcnlTZXJ2aWNlcy5EaXJlY3RvcnlFbnRyeQoKIyBSZWFkIG1heFB3ZEFnZSBhdHRyaWJ1dGUgYW5kIGNvbnZlcnQgdG8gSW50NjQKJG1heFB3ZEFnZSA9IEFkc0xhcmdlSW50ZWdlclRvSW42NCAkRG9tYWluLm1heFB3ZEFnZS5WYWx1ZQ=="&gt;Download&lt;/a&gt;
 &lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="codebody"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$domain = New-Object System.DirectoryServices.DirectoryEntry
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Read maxPwdAge attribute and convert to Int64
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$maxPwdAge = AdsLargeIntegerToIn64 $Domain.maxPwdAge.Value&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In my case this returns the value -78624000000000 but how do we interpret this? 
 &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Embedding images in HTML</title><link>https://remkoweijnen.nl/blog/2011/12/02/embedding-images-in-html/</link><pubDate>Fri, 02 Dec 2011 13:09:43 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/12/02/embedding-images-in-html/</guid><description>&lt;p&gt;I was creating a small dialog in an &lt;a href="http://en.wikipedia.org/wiki/HTML_Application" target="_blank"&gt;.hta file&lt;/a&gt; and to make a little prettier for the user I included a company logo:&lt;/p&gt; &lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/12/SNAGHTMLdfa805.webp" class="glightbox" data-type="image" data-gallery="post-2209"&gt;&lt;img loading="lazy" decoding="async" 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="https://remkoweijnen.nl/blog/wp-content/uploads/2011/12/SNAGHTMLdfa805_thumb.webp" width="270" height="206" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;But I wanted to deploy the .hta as a single file.&lt;/p&gt;</description></item><item><title>Convert IADsLargeInteger to Int64 in PowerShell</title><link>https://remkoweijnen.nl/blog/2011/12/01/convert-iadslargeinteger-to-int64-in-powershell/</link><pubDate>Thu, 01 Dec 2011 16:03:46 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/12/01/convert-iadslargeinteger-to-int64-in-powershell/</guid><description>&lt;p&gt;&lt;img style="display: inline; float: right;" src="data:image/jpeg;base64,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" alt="" width="70" height="67" align="right" /&gt;Some Active Directory attributes return an 8 byte integer in the form of an &lt;a href="file://\\LargeInteger" target="_blank"&gt;IADsLargeInteger&lt;/a&gt; interface. An example is the pwdLastSet attribute from a user object.&lt;/p&gt;
&lt;p&gt;Because the IADsLargeInteger object doesn&amp;rsquo;t provide type information PowerShell cannot read the HighPart and LowPart properties.&lt;/p&gt;
&lt;p&gt;So I wrote the function below to get the Int64 value of an IADsLargeInteger:&lt;/p&gt;</description></item><item><title>Set homefolder permissions with PowerShell</title><link>https://remkoweijnen.nl/blog/2011/11/08/set-homefolder-permissions-with-powershell/</link><pubDate>Tue, 08 Nov 2011 21:05:19 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/11/08/set-homefolder-permissions-with-powershell/</guid><description>&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/11/image2.webp" class="glightbox" data-type="image" data-gallery="post-2154"&gt;&lt;img loading="lazy" decoding="async" style="margin: 0px 0px 0px 10px; display: inline; float: right;" title="image" src="https://remkoweijnen.nl/blog/wp-content/uploads/2011/11/image_thumb2.webp" alt="image" width="77" height="66" align="right" /&gt;&lt;/a&gt;Today one of my collegues asked me to write a script that performs two actions for all users of a certain Organizational Unit:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;span style="color: #35383d;"&gt;Ensure that each user has&lt;/span&gt; modify permissions on their homefolder&lt;/li&gt;
	&lt;li&gt;Make each user visible in the Exchange Address List.&lt;/li&gt;
&lt;/ol&gt;
Sounds like a PowerShell job right?
&lt;p&gt;I reused my function to &lt;a href="https://remkoweijnen.nl/blog/2011/09/02/settings-ntfs-permissions-by-sid-in-powershell/" target="_blank"&gt;set NTFS Permissions by SID&lt;/a&gt;:&lt;/p&gt;</description></item><item><title>Construct AQS date range with PowerShell</title><link>https://remkoweijnen.nl/blog/2011/11/04/construct-aqs-date-range-with-powershell/</link><pubDate>Fri, 04 Nov 2011 16:05:25 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/11/04/construct-aqs-date-range-with-powershell/</guid><description>&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/11/image.webp" class="glightbox" data-type="image" data-gallery="post-2151"&gt;&lt;img loading="lazy" decoding="async" style="margin: 0px 7px 0px 0px; display: inline; float: left" title="image" alt="image" align="left" src="https://remkoweijnen.nl/blog/wp-content/uploads/2011/11/image_thumb.webp" width="53" height="52" /&gt;&lt;/a&gt;For a script I needed to create an AQS (&lt;a href="http://msdn.microsoft.com/en-us/library/aa965711(v=vs.85).aspx" target="_blank"&gt;Advanced Query Syntax&lt;/a&gt;) Query that contained a date range.&lt;/p&gt; &lt;p&gt;An example of such is a range is: &lt;strong&gt;date:11/05/04..11/10/04&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;However we need to account for regional settings where for example the data seperator and the order of day and month may be different.&lt;/p&gt; &lt;p&gt;In my example I wanted to match any data that is 30 days or older so let's do this in PowerShell:&lt;/p&gt;</description></item><item><title>Exchange Move Mailbox Experiences Part 3</title><link>https://remkoweijnen.nl/blog/2011/09/28/exchange-move-mailbox-experiences-part-3/</link><pubDate>Wed, 28 Sep 2011 11:08:21 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/09/28/exchange-move-mailbox-experiences-part-3/</guid><description>&lt;p&gt;In &lt;a href="https://remkoweijnen.nl/blog/2011/09/27/exchange-move-mailbox-experiences-part-2/" target="_blank"&gt;Part 2&lt;/a&gt; I showed some details about Mailbox Rule corruptions that can disturb Mailbox Moves.&lt;/p&gt; &lt;p&gt;For this part the topic is Mailbox size, which can be an important factor in deciding which mailboxes you want to move first.&lt;/p&gt; &lt;p&gt;In my case the mailbox size was important because we agreed to move smaller mailboxes during the day but larger mailboxes only outside working hours.&lt;/p&gt; &lt;p&gt;For Exchange 2010 mailboxes it's very easy to obtain the size using PowerShell. &lt;/p&gt; &lt;p&gt;Example:&lt;/p&gt; 
&lt;div class="codecard"&gt;
 &lt;div class="codehead"&gt;
 &lt;span class="codefile"&gt;&lt;/span&gt;
 &lt;span class="codetools" data-pagefind-ignore&gt;
 &lt;span class="codelang"&gt;powershell&lt;/span&gt;
 &lt;button class="codebtn" type="button" data-copy&gt;Copy&lt;/button&gt;
 &lt;a class="codebtn" download=".ps1" href="data:text/plain;charset=utf-8;base64,R2V0LU1haWxib3ggInJ3ZWlqbmVuIiB8IEdldC1NYWlsYm94U3RhdGlzdGljcyB8IHNlbGVjdCBEaXNwbGF5TmFtZSwgSXRlbUNvdW50LCBUb3RhbEl0ZW1TaXpl"&gt;Download&lt;/a&gt;
 &lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="codebody"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;Get-Mailbox&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;rweijnen&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="nb"&gt;Get-MailboxStatistics&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="nb"&gt;select &lt;/span&gt;&lt;span class="n"&gt;DisplayName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ItemCount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;TotalItemSize&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;table border="0" cellspacing="10" cellpadding="2" width="430"&gt;&lt;tbody&gt;
 &lt;tr&gt;
 &lt;td valign="top" width="130"&gt;DisplayName&lt;/td&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;td valign=&amp;quot;top&amp;quot; width=&amp;quot;70&amp;quot; align=&amp;quot;right&amp;quot;&amp;gt;ItemCount&amp;lt;/td&amp;gt;

 &amp;lt;td valign=&amp;quot;top&amp;quot; width=&amp;quot;230&amp;quot; align=&amp;quot;right&amp;quot;&amp;gt;TotalItemSize&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;tr&amp;gt;
 &amp;lt;td valign=&amp;quot;top&amp;quot; width=&amp;quot;130&amp;quot;&amp;gt;Remko Weijnen&amp;lt;/td&amp;gt;

 &amp;lt;td valign=&amp;quot;top&amp;quot; width=&amp;quot;70&amp;quot; align=&amp;quot;right&amp;quot;&amp;gt;313&amp;lt;/td&amp;gt;

 &amp;lt;td valign=&amp;quot;top&amp;quot; width=&amp;quot;230&amp;quot; align=&amp;quot;right&amp;quot;&amp;gt;34.87 MB (36,564,183 bytes&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
 &lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;But how can we get the Mailbox Size for Exchange 2003 mailboxes?&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;</description></item><item><title>Inline arrays in PowerShell</title><link>https://remkoweijnen.nl/blog/2011/09/28/inline-arrays-in-powershell/</link><pubDate>Wed, 28 Sep 2011 10:34:18 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/09/28/inline-arrays-in-powershell/</guid><description>&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/09/image28.webp" class="glightbox" data-type="image" data-gallery="post-2119"&gt;&lt;img loading="lazy" decoding="async" style="background-image: none; margin: 0px 0px 0px 16px; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border: 0px;" title="image" src="https://remkoweijnen.nl/blog/wp-content/uploads/2011/09/image_thumb28.webp" alt="image" width="119" height="79" align="right" border="0" /&gt;&lt;/a&gt;Sometimes I want to process a list of &amp;ldquo;things&amp;rdquo; easily in PowerShell where the list is not in an external file but in the script itself.&lt;/p&gt;
&lt;p&gt;Ideally this list would not be separated by e.g. a comma so it can be easily copy/pasted from external data sources.&lt;/p&gt;
&lt;p&gt;Something like this:&lt;/p&gt;
&lt;div class="codecard"&gt;
 &lt;div class="codehead"&gt;
 &lt;span class="codefile"&gt;&lt;/span&gt;
 &lt;span class="codetools" data-pagefind-ignore&gt;
 &lt;span class="codelang"&gt;powershell&lt;/span&gt;
 &lt;button class="codebtn" type="button" data-copy&gt;Copy&lt;/button&gt;
 &lt;a class="codebtn" download=".ps1" href="data:text/plain;charset=utf-8;base64,JExpc3QgPSBAKCIKSm9obiBEb2UKSmFuZSBEb2UKSmFtZXMgQm9uZApBbmQgc28gdGhlIGxpc3QgZ29lcyBvbgoiKQ=="&gt;Download&lt;/a&gt;
 &lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="codebody"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$List&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="vm"&gt;@&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;John Doe
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;Jane Doe
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;James Bond
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;And so the list goes on
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>Settings NTFS Permissions by SID in PowerShell</title><link>https://remkoweijnen.nl/blog/2011/09/02/settings-ntfs-permissions-by-sid-in-powershell/</link><pubDate>Fri, 02 Sep 2011 17:21:42 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/09/02/settings-ntfs-permissions-by-sid-in-powershell/</guid><description>&lt;p&gt;&lt;img style="margin: 0px 0px 0px 10px" align="right" src="http://t0.gstatic.com/images?q=tbn:ANd9GcTPzlU95MOmfR0YwGb55TQkoZENCxgxFUKqp6qqfMMaa9skPMT5gw" width="60" height="47" /&gt;I am currently creating a PowerShell script that creates a user with all needed Active Directory attributes, Exchange mailbox, (TS) Home- and Profile directories and so on.&lt;/p&gt; &lt;p&gt;In such a script you can easily get failures because of Active Directory replication. &lt;br /&gt; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Check if a useraccount exists with PowerShell</title><link>https://remkoweijnen.nl/blog/2011/09/02/check-if-a-useraccount-exists-with-powershell/</link><pubDate>Fri, 02 Sep 2011 11:51:37 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/09/02/check-if-a-useraccount-exists-with-powershell/</guid><description>&lt;p&gt;Function below can be used to check if a given Username exists in Active Directory:&lt;/p&gt;
&lt;div class="codecard"&gt;
 &lt;div class="codehead"&gt;
 &lt;span class="codefile"&gt;&lt;/span&gt;
 &lt;span class="codetools" data-pagefind-ignore&gt;
 &lt;span class="codelang"&gt;powershell&lt;/span&gt;
 &lt;button class="codebtn" type="button" data-copy&gt;Copy&lt;/button&gt;
 &lt;a class="codebtn" download=".ps1" href="data:text/plain;charset=utf-8;base64,ZnVuY3Rpb24gVXNlckV4aXN0cyhbc3RyaW5nXSRVc2VybmFtZSkKewoJJHN0ckZpbHRlciA9ICIoJihvYmplY3RDYXRlZ29yeT1wZXJzb24pKHNBTUFjY291bnROYW1lPSRVc2VybmFtZSkpIgoKCSRvYmpEb21haW4gPSBOZXctT2JqZWN0IFN5c3RlbS5EaXJlY3RvcnlTZXJ2aWNlcy5EaXJlY3RvcnlFbnRyeQoKCSRvYmpTZWFyY2hlciA9IE5ldy1PYmplY3QgU3lzdGVtLkRpcmVjdG9yeVNlcnZpY2VzLkRpcmVjdG9yeVNlYXJjaGVyCgkkb2JqU2VhcmNoZXIuU2VhcmNoUm9vdCA9ICRvYmpEb21haW4KCSRvYmpTZWFyY2hlci5QYWdlU2l6ZSA9IDEwMDAKCSRvYmpTZWFyY2hlci5GaWx0ZXIgPSAkc3RyRmlsdGVyCgkkb2JqU2VhcmNoZXIuU2VhcmNoU2NvcGUgPSAiU3VidHJlZSIKCgkkY29sUmVzdWx0cyA9ICRvYmpTZWFyY2hlci5GaW5kQWxsKCkKCXJldHVybiBbYm9vbF0oJGNvbFJlc3VsdHMgLW5lICRudWxsKQp9"&gt;Download&lt;/a&gt;
 &lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="codebody"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;UserExists([string]$Username&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="nv"&gt;$strFilter&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;(&amp;amp;(objectCategory=person)(sAMAccountName=&lt;/span&gt;&lt;span class="nv"&gt;$Username&lt;/span&gt;&lt;span class="s2"&gt;))&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="nv"&gt;$objDomain&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;New-Object&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;DirectoryServices&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;DirectoryEntry&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="nv"&gt;$objSearcher&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;New-Object&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;DirectoryServices&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;DirectorySearcher&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="nv"&gt;$objSearcher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;SearchRoot&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$objDomain&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="nv"&gt;$objSearcher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;PageSize&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="nv"&gt;$objSearcher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;Filter&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$strFilter&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="nv"&gt;$objSearcher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;SearchScope&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Subtree&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="nv"&gt;$colResults&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$objSearcher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;FindAll&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="nv"&gt;$colResults&lt;/span&gt; &lt;span class="o"&gt;-ne&lt;/span&gt; &lt;span class="vm"&gt;$null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>Get smallest Exchange Database in PowerShell</title><link>https://remkoweijnen.nl/blog/2011/08/16/get-smallest-exchange-database-in-powershell/</link><pubDate>Tue, 16 Aug 2011 14:16:33 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/08/16/get-smallest-exchange-database-in-powershell/</guid><description>&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/SNAGHTML1ca684c.webp"&gt;&lt;img loading="lazy" decoding="async" style="margin: 0px 10px 0px 0px" title="SNAGHTML1ca684c" border="0" alt="SNAGHTML1ca684c" align="left" src="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/SNAGHTML1ca684c_thumb.webp" width="49" height="49" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;I needed to adapt some scripts that create a user with mailbox for Exchange 2010. The existing scripts had a hardcoded database for new mailboxes.&lt;/p&gt; &lt;p&gt;I wanted the mailbox to be created in the smallest database, but how do we determine this?&lt;/p&gt;</description></item><item><title>Set Exchange Product Key with PowerShell</title><link>https://remkoweijnen.nl/blog/2011/08/15/set-exchange-product-key-with-powershell/</link><pubDate>Mon, 15 Aug 2011 09:17:14 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/08/15/set-exchange-product-key-with-powershell/</guid><description>&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/SNAGHTML1ca684c.webp"&gt;&lt;img loading="lazy" decoding="async" style="margin: 0px 10px 0px 0px" title="SNAGHTML1ca684c" border="0" alt="SNAGHTML1ca684c" align="left" src="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/SNAGHTML1ca684c_thumb.webp" width="49" height="49" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;By default Exchange 2007 and 2010 are installed in Trial mode so before going into production you need to enter the Product Key.&lt;/p&gt; &lt;p&gt;The Exchange Management Console will warn you if one or more servers are still in trial mode:&lt;/p&gt; &lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/08/image.webp" class="glightbox" data-type="image" data-gallery="post-1985"&gt;&lt;img loading="lazy" decoding="async" 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="https://remkoweijnen.nl/blog/wp-content/uploads/2011/08/image_thumb.webp" width="419" height="246" /&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>PowerShell script to set Exchange Static RPC Ports</title><link>https://remkoweijnen.nl/blog/2011/08/10/powershell-script-to-set-exchange-static-rpc-ports/</link><pubDate>Wed, 10 Aug 2011 16:49:01 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/08/10/powershell-script-to-set-exchange-static-rpc-ports/</guid><description>&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/SNAGHTML1ca684c.webp"&gt;&lt;img loading="lazy" decoding="async" style="margin: 0px 10px 0px 0px" title="SNAGHTML1ca684c" border="0" alt="SNAGHTML1ca684c" align="left" src="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/SNAGHTML1ca684c_thumb.webp" width="49" height="49" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;I am currently working on an Exchange migration from 2003 to 2010. For the implementation of a load balancing solution for the CAS/HUB servers I needed to set Static RPC Ports for the &lt;em&gt;RPC Client Access Service&lt;/em&gt; and the &lt;em&gt;Exchange Address Book Service&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;The procedure of changing these ports is described on the Technet Wiki: &lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/configure-static-rpc-ports-on-an-exchange-2010-client-access-server.aspx" target="_blank"&gt;Configure Static RPC Ports on an Exchange 2010 Client Access Server&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;img alt="" align="right" src="http://t0.gstatic.com/images?q=tbn:ANd9GcTPzlU95MOmfR0YwGb55TQkoZENCxgxFUKqp6qqfMMaa9skPMT5gw" width="66" height="52" /&gt;Since I am lazy I decided to do this with a PowerShell script that would automatically do this for all CAS/HUB servers in my 2010 environment.&lt;/p&gt;</description></item><item><title>AD Internals: Display RID Allocation Pools</title><link>https://remkoweijnen.nl/blog/2011/06/27/ad-internals-display-rid-allocation-pools/</link><pubDate>Mon, 27 Jun 2011 15:37:04 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/06/27/ad-internals-display-rid-allocation-pools/</guid><description>&lt;p&gt;In my previous post I wrote about a problem I had with duplicate RID Allocation pools. &lt;/p&gt; &lt;p&gt;But how do we get more insight into these RID Allocation pools?&lt;/p&gt; &lt;p&gt;The DCDIAG tool can display this information per domain controleler using the following syntax&lt;/p&gt; 
&lt;div class="codecard"&gt;
 &lt;div class="codehead"&gt;
 &lt;span class="codefile"&gt;&lt;/span&gt;
 &lt;span class="codetools" data-pagefind-ignore&gt;
 &lt;span class="codelang"&gt;batch&lt;/span&gt;
 &lt;button class="codebtn" type="button" data-copy&gt;Copy&lt;/button&gt;
 &lt;a class="codebtn" download=".bat" href="data:text/plain;charset=utf-8;base64,ZGNkaWFnIC9zOnNlcnZlciAvdiAvdGVzdDpyaWRtYW5hZ2Vy"&gt;Download&lt;/a&gt;
 &lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="codebody"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-batch" data-lang="batch"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dcdiag /s:server /v /test:ridmanager&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Example output:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/image28.webp" class="glightbox" data-type="image" data-gallery="post-1950"&gt;&lt;img loading="lazy" decoding="async" 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="DCDiag Ridmanager Test" border="0" alt="DCDiag Ridmanager Test" src="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/image_thumb28.webp" width="419" height="85" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But where in Active Directory is this information stored and can we display it for all Domain Controllers at once for larger environments?&lt;/p&gt;</description></item><item><title>Exchange 2010 well-known object entry install error</title><link>https://remkoweijnen.nl/blog/2011/06/24/exchange-2010-well-known-object-entry-install-error/</link><pubDate>Fri, 24 Jun 2011 12:52:30 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/06/24/exchange-2010-well-known-object-entry-install-error/</guid><description>&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/SNAGHTML1ca684c.webp" class="glightbox" data-type="image" data-gallery="post-1921"&gt;&lt;img loading="lazy" decoding="async" style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="SNAGHTML1ca684c" src="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/SNAGHTML1ca684c_thumb.webp" border="0" alt="SNAGHTML1ca684c" width="49" height="49" align="left" /&gt;&lt;/a&gt;Today I was testing the installation of Exchange 2010 in a VMWare sandbox environment. We created the sandbox to test migration from a 2003 AD and Exchange environment to 2008 R2 with Exchange 2010.&lt;/p&gt;
&lt;p&gt;We used a P2V to get real copies of the Active Directory and the AD upgrade to 2008 R2 was already tested.&lt;/p&gt;
&lt;p&gt;But during the Exchange installation in the sandbox I got the following error:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/image16.webp" class="glightbox" data-type="image" data-gallery="post-1921"&gt;&lt;img loading="lazy" decoding="async" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Exchange Server 2010 Setup Error" src="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/image_thumb16.webp" border="0" alt="The well-known object entry on the otherWellKnownObjects attribute in the container object CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=zorg,DC=local points to an invalid DN or a deleted object. Remove the entry, and then rerun the task." width="429" height="366" /&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Reading the otherWellKnownObjects attribute with PowerShell</title><link>https://remkoweijnen.nl/blog/2011/06/24/reading-the-otherwellknownobjects-attribute-with-powershell/</link><pubDate>Fri, 24 Jun 2011 11:19:25 +0000</pubDate><guid>https://remkoweijnen.nl/blog/2011/06/24/reading-the-otherwellknownobjects-attribute-with-powershell/</guid><description>&lt;p&gt;I wanted to read the &lt;a href="http://msdn.microsoft.com/en-us/library/ms679095(v=vs.85).aspx" target="_blank"&gt;otherWellKnownObjects&lt;/a&gt; attribute from an Active Directory object.&lt;/p&gt; &lt;p&gt;In my case this was the Microsoft Exchange container in the Configuration partition:&lt;/p&gt; &lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/image14.webp" class="glightbox" data-type="image" data-gallery="post-1899"&gt;&lt;img loading="lazy" decoding="async" style="background-image: none; border-right-width: 0px; margin: 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="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/image_thumb14.webp" width="243" height="317" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;The otherWellKnownObjects attribute is of type ADSTYPE_DN_WITH_BINARY which unfortunately cannot be viewed or edited with ADSI Edit:&lt;/p&gt; &lt;p&gt;&lt;a href="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/image15.webp" class="glightbox" data-type="image" data-gallery="post-1899"&gt;&lt;img loading="lazy" decoding="async" 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="ADSI Edit" border="0" alt="There is no editor registered to handle this attribute type" src="https://remkoweijnen.nl/blog/wp-content/uploads/2011/06/image_thumb15.webp" width="381" height="149" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt;</description></item></channel></rss>