<?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>Aaron Parker &#187; Scripting</title>
	<atom:link href="http://blog.stealthpuppy.com/category/scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.stealthpuppy.com</link>
	<description>on application delivery with application virtualization, server-based computing, desktop virtualization and more</description>
	<lastBuildDate>Fri, 18 May 2012 14:08:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>CD/DVD Writing via Script with IMAPIv2</title>
		<link>http://blog.stealthpuppy.com/scripting/cddvd-writing-via-script-with-imapiv2/</link>
		<comments>http://blog.stealthpuppy.com/scripting/cddvd-writing-via-script-with-imapiv2/#comments</comments>
		<pubDate>Mon, 05 Nov 2007 13:18:58 +0000</pubDate>
		<dc:creator>Aaron Parker</dc:creator>
				<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://blog.stealthpuppy.com/scripting/cddvd-writing-via-script-with-imapiv2</guid>
		<description><![CDATA[Looking to write to CD or DVD media via a script? Did you know that Windows includes an API to do just that? Version 2.0 of this API that is included in Windows Vista has also beenÂ made available for Windows &#8230; <a href="http://blog.stealthpuppy.com/scripting/cddvd-writing-via-script-with-imapiv2/">Continue reading <span class="meta-nav">&#8594;</span></a><p><div style="padding: 5px 5px 5px 5px; border: 1px solid #cccccc; color: #303030; background-color: #f4f4f4;"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" style="float:left;margin-right:5px;border:0px;" /></a><a href="http://blog.stealthpuppy.com/scripting/cddvd-writing-via-script-with-imapiv2/">CD/DVD Writing via Script with IMAPIv2</a>  is post from <a href="http://blog.stealthpuppy.com/">stealthpuppy.com</a>.  Except as noted otherwise, this work is &copy; 2005-2012 Aaron Parker and is licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.</div></p>
]]></description>
			<content:encoded><![CDATA[<p>Looking to write to CD or DVD media via a script? Did you know that Windows includes an API to do just that? Version 2.0 of this API that is included in Windows Vista has also beenÂ made available for Windows XP and Windows Server 2003: <a href="http://www.microsoft.com/technet/scriptcenter/newswire/imapi2xp.mspx">Image Mastering API v2.0</a></p>
<blockquote><p>IMAPI is the optical burning engine in Windows products. Version 2 of IMAPI will extend Windows Vista support for DVD media to Windows XP and to Windows Server 2003.</p></blockquote>
<p>I wasn&#8217;t previously aware of this API and it looks pretty cool, TechNet has full details on the API and how to use it:</p>
<ul>
<li><a href="http://www.microsoft.com/technet/scriptcenter/topics/imapi/imapi2-1.mspx">Introduction to IMAPIv2 for Script Writers</a></li>
<li><a href="http://www.microsoft.com/technet/scriptcenter/topics/imapi/imapi2-2.mspx">Burning CDs and DVDs from Scripts</a></li>
</ul>
<p>Here are the links for the KB article describing the version 2.0 update and where to download it for Windows XP/Server 2003:</p>
<ul>
<li><a href="http://support.microsoft.com/?kbid=932716">Description of the Image Mastering API v2.0 (IMAPIv2.0) update package</a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=b5f726f1-4ace-455d-bad7-abc4dd2f147b&amp;DisplayLang=en">Image Mastering API v2.0 for Windows XP</a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=fe4770f5-91fa-4390-920a-f4d45c67923c&amp;DisplayLang=en">Image Mastering API v2.0 for Windows Server 2003</a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5b91629c-3150-47c0-b4ee-de18dd30a61c&amp;DisplayLang=en">Image Mastering API v2.0 for Windows XP x64 Edition </a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=316584fa-a268-4208-9050-137f59de89e9&amp;DisplayLang=en">Image Mastering API v2.0 for Windows Server 2003 x64 Edition</a></li>
</ul>
<p><div style="padding: 5px 5px 5px 5px; border: 1px solid #cccccc; color: #303030; background-color: #f4f4f4;"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" style="float:left;margin-right:5px;border:0px;" /></a><a href="http://blog.stealthpuppy.com/scripting/cddvd-writing-via-script-with-imapiv2/">CD/DVD Writing via Script with IMAPIv2</a>  is post from <a href="http://blog.stealthpuppy.com/">stealthpuppy.com</a>.  Except as noted otherwise, this work is &copy; 2005-2012 Aaron Parker and is licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.</div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.stealthpuppy.com/scripting/cddvd-writing-via-script-with-imapiv2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Script: Update Published Application Icons</title>
		<link>http://blog.stealthpuppy.com/scripting/script-update-published-application-icons/</link>
		<comments>http://blog.stealthpuppy.com/scripting/script-update-published-application-icons/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 14:33:05 +0000</pubDate>
		<dc:creator>Aaron Parker</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Presentation-Server]]></category>

		<guid isPermaLink="false">http://blog.stealthpuppy.com/scripting/script-update-published-application-icons</guid>
		<description><![CDATA[In a previous post I detailed updating your Citrix Presentation Server 4.5 environment to support true/high colour icons for published applications. One of the steps mentioned in the post is that you need to delete and re-publish each of your &#8230; <a href="http://blog.stealthpuppy.com/scripting/script-update-published-application-icons/">Continue reading <span class="meta-nav">&#8594;</span></a><p><div style="padding: 5px 5px 5px 5px; border: 1px solid #cccccc; color: #303030; background-color: #f4f4f4;"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" style="float:left;margin-right:5px;border:0px;" /></a><a href="http://blog.stealthpuppy.com/scripting/script-update-published-application-icons/">Script: Update Published Application Icons</a>  is post from <a href="http://blog.stealthpuppy.com/">stealthpuppy.com</a>.  Except as noted otherwise, this work is &copy; 2005-2012 Aaron Parker and is licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.</div></p>
]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://blog.stealthpuppy.com/terminal-server/high-colour-icons-for-citrix-presentation-server-applications">a previous post</a> I detailed updating your Citrix Presentation Server 4.5 environment to support true/high colour icons for published applications. One of the steps mentioned in the post is that you need to delete and re-publish each of your published applications to get a high colour icon, which detailed in the release notes for <a href="http://support.citrix.com/article/CTX112618">PSE450W2K3R01</a>.</p>
<p>As <a href="http://blog.stealthpuppy.com/terminal-server/high-colour-icons-for-citrix-presentation-server-applications#comment-3695">Joe Shonk</a> points out though, you don&#8217;t need to re-publish each application, you only need to updae the icon. To that end, I&#8217;ve created another script that will do this for you:</p>
<p><a href="http://blog.stealthpuppy.com/unattended/wsf-update-published-application-icons-10" class="broken_link">Update Published Application Icons 1.0</a></p>
<p>This script will go through each published application and update it with the icon from the applications executable. It its current form the script may not be suitable for your environment so you may need to modify it.</p>
<p><div style="padding: 5px 5px 5px 5px; border: 1px solid #cccccc; color: #303030; background-color: #f4f4f4;"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" style="float:left;margin-right:5px;border:0px;" /></a><a href="http://blog.stealthpuppy.com/scripting/script-update-published-application-icons/">Script: Update Published Application Icons</a>  is post from <a href="http://blog.stealthpuppy.com/">stealthpuppy.com</a>.  Except as noted otherwise, this work is &copy; 2005-2012 Aaron Parker and is licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.</div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.stealthpuppy.com/scripting/script-update-published-application-icons/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Creating Custom MetaFrame Admins with VBscript: Part 2</title>
		<link>http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-2/</link>
		<comments>http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-2/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 09:10:39 +0000</pubDate>
		<dc:creator>Aaron Parker</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Presentation-Server]]></category>

		<guid isPermaLink="false">http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-2</guid>
		<description><![CDATA[Creating the Administrator Now that we can read the privileges from an existing administrator object we can determine which privileges to write to a new administrator. In this post I have listed a script that you can use to create &#8230; <a href="http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-2/">Continue reading <span class="meta-nav">&#8594;</span></a><p><div style="padding: 5px 5px 5px 5px; border: 1px solid #cccccc; color: #303030; background-color: #f4f4f4;"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" style="float:left;margin-right:5px;border:0px;" /></a><a href="http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-2/">Creating Custom MetaFrame Admins with VBscript: Part 2</a>  is post from <a href="http://blog.stealthpuppy.com/">stealthpuppy.com</a>.  Except as noted otherwise, this work is &copy; 2005-2012 Aaron Parker and is licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.</div></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>Creating the Administrator</strong><br />
Now that we can read the privileges from an existing administrator object we can determine which privileges to write to a new administrator. In this post I have listed a script that you can use to create the custom administrator account.</p>
<p>This script uses arrays of values for the privileges (I&#8217;ve used the value rather than their names to reduce the size of the script. See the SDK documentation if you would rather refer to the privileges by their names). The arrays listed in the code will set every single privilege so you will need to edit them when setting your own administrator accounts.</p>
<p>The script can be broken down into this process:</p>
<ol>
<li>Set the privilege arrays.</li>
<li>Return the list of Application and Server folders.</li>
<li>Bind to the Presentation Server farm.</li>
<li>Create the administrator account.</li>
<li>Bind to the new administrator account and set the first set of privileges.</li>
<li>Bind to the Server folders and assign privileges to the new administrator account.</li>
<li>Bind to the Applications folders and assign privileges to the new administrator account.</li>
</ol>
<p>The script uses a function to add privileges to the Application or Server folders. Pass the folder name, the folder type (MetaFrameAppFolder or MetaFrameSrvFolder), the account domain and account name and the privilege set as an array and the function does the rest.</p>
<p>During testing I have noticed that the privileges are not set on the last Application folder in the list &#8211; if you take a look at the code you can see that I am setting the privileges on that folder a second time. If anyone else is seeing this behaviour please let me know.</p>
<p><iframe scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:240px;height:66px;margin:3px;padding:0;border:1px solid #dde5e9;background-color:#ffffff;" src="http://cid-74b5baa3414de283.skydrive.live.com/embedrowdetail.aspx/Public/Script%20Corner/Citrix/Creating-XenApp-Admins-Part2.txt"></iframe></p>
<p><div style="padding: 5px 5px 5px 5px; border: 1px solid #cccccc; color: #303030; background-color: #f4f4f4;"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" style="float:left;margin-right:5px;border:0px;" /></a><a href="http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-2/">Creating Custom MetaFrame Admins with VBscript: Part 2</a>  is post from <a href="http://blog.stealthpuppy.com/">stealthpuppy.com</a>.  Except as noted otherwise, this work is &copy; 2005-2012 Aaron Parker and is licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.</div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating Custom MetaFrame Admins with VBscript: Part 1</title>
		<link>http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-1/</link>
		<comments>http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-1/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 08:18:19 +0000</pubDate>
		<dc:creator>Aaron Parker</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Presentation-Server]]></category>

		<guid isPermaLink="false">http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-1</guid>
		<description><![CDATA[Overview Setting privileges on a custom administrator account in Presentation Server is not quite as simple as I thought when I set out to create a script to do so &#8211; there&#8217;s not much information on the CDN forums, so &#8230; <a href="http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-1/">Continue reading <span class="meta-nav">&#8594;</span></a><p><div style="padding: 5px 5px 5px 5px; border: 1px solid #cccccc; color: #303030; background-color: #f4f4f4;"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" style="float:left;margin-right:5px;border:0px;" /></a><a href="http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-1/">Creating Custom MetaFrame Admins with VBscript: Part 1</a>  is post from <a href="http://blog.stealthpuppy.com/">stealthpuppy.com</a>.  Except as noted otherwise, this work is &copy; 2005-2012 Aaron Parker and is licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.</div></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>Overview</strong><br />
Setting privileges on a custom administrator account in Presentation Server is not quite as simple as I thought when I set out to create a script to do so &#8211; there&#8217;s not much information on the CDN forums, so this was a bit of trial and error.</p>
<p>The process for creating a custom administrator account and setting privileges goes like this:</p>
<ol>
<li>Create the custom administrator account.</li>
<li>Bind to the new account and add privileges except for those that apply to application or server folders.</li>
<li>Bind to the Applications folder/s and add privileges for the specified administrator.</li>
<li>Bind to the Servers folder/s and add privileges for the specified administrator.</li>
</ol>
<p>As you can see the process isn&#8217;t completed in a single step, there are actually three seperate steps to setting privileges. The first is setting privileges on the objects outlined here in this screenshot (those objects in colour):</p>
<p style="text-align: center"><img src="http://blog.stealthpuppy.com/wp-content/uploads/2007/08/ctx-privsset1.png" alt="ctx-privsset1.png" /></p>
<p>The next steps set the permissions on the folder objects rather than the administrator object as outlined in this screenshot (those objects in colour):</p>
<p style="text-align: center"><img src="http://blog.stealthpuppy.com/wp-content/uploads/2007/08/ctx-privsset2.png" alt="ctx-privsset2.png" /></p>
<p>Something I should note here though, is that I&#8217;ve not been able to set permissions on the Monitoring Profiles folder. I could be wrong but from what I can tell you can&#8217;t currently access these types of folders.</p>
<p><strong>Reading The Privileges</strong><br />
First up I had to read the privileges from an existing object to make it simpler to set the privileges on any new administrators &#8211; you&#8217;ve gotta learn to read before you can write. Initially setting the privileges is easy via the Access Management Console then programatically reading back then simplifies the write process.</p>
<p>Reading the privileges on an administrator account is simple enough because we can bind to the administrator object and then read the privileges. Reading the privileges for that account on the Applications and Servers folders is a little different &#8211; unless you want to statically supply the list of folders, you&#8217;ll need to enumerate them.</p>
<p>I&#8217;ve created a fuction and a few subroutines, based on some code from the CDN forums, that will return an array containing the distinguished names of the Application or Server folders. The code essentially walks the folder tree to find the subfolders of each folder, while calling itself to do so until the subfolder count reaches 0.</p>
<p>The full script will echo out the privleges in both the numerical value and the privilege name defined by MetaFrameAdminPrivilege. Check out the MFCOM SDK 4.5 for a complete list of the privileges. This script will work on Presentation Server 4.0 and 4.5, I&#8217;ve not tested on any earlier versions.</p>
<p><iframe scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:240px;height:66px;margin:3px;padding:0;border:1px solid #dde5e9;background-color:#ffffff;" src="http://cid-74b5baa3414de283.skydrive.live.com/embedrowdetail.aspx/Public/Script%20Corner/Citrix/Creating-XenApp-Admins-Part1.txt"></iframe></p>
<p>Continue to <a href="http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-2">part 2 here</a></p>
<p><div style="padding: 5px 5px 5px 5px; border: 1px solid #cccccc; color: #303030; background-color: #f4f4f4;"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" style="float:left;margin-right:5px;border:0px;" /></a><a href="http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-1/">Creating Custom MetaFrame Admins with VBscript: Part 1</a>  is post from <a href="http://blog.stealthpuppy.com/">stealthpuppy.com</a>.  Except as noted otherwise, this work is &copy; 2005-2012 Aaron Parker and is licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.</div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.stealthpuppy.com/scripting/creating-custom-metaframe-admins-with-vbscript-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quering Domino via LDAP with VBscript</title>
		<link>http://blog.stealthpuppy.com/scripting/quering-domino-via-ldap-with-vbscript/</link>
		<comments>http://blog.stealthpuppy.com/scripting/quering-domino-via-ldap-with-vbscript/#comments</comments>
		<pubDate>Wed, 08 Aug 2007 08:33:16 +0000</pubDate>
		<dc:creator>Aaron Parker</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[VBscript]]></category>

		<guid isPermaLink="false">http://blog.stealthpuppy.com/uncategorized/quering-domino-via-ldap-with-vbscript</guid>
		<description><![CDATA[I don&#8217;t really want to admit to interacting with Lotus Notes but that&#8217;s a part of what I&#8217;m doing currently. More specificially I&#8217;m attempting to query Domino via LDAP with a VBS script. It turns out that this is a &#8230; <a href="http://blog.stealthpuppy.com/scripting/quering-domino-via-ldap-with-vbscript/">Continue reading <span class="meta-nav">&#8594;</span></a><p><div style="padding: 5px 5px 5px 5px; border: 1px solid #cccccc; color: #303030; background-color: #f4f4f4;"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" style="float:left;margin-right:5px;border:0px;" /></a><a href="http://blog.stealthpuppy.com/scripting/quering-domino-via-ldap-with-vbscript/">Quering Domino via LDAP with VBscript</a>  is post from <a href="http://blog.stealthpuppy.com/">stealthpuppy.com</a>.  Except as noted otherwise, this work is &copy; 2005-2012 Aaron Parker and is licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.</div></p>
]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t really want to admit to interacting with <a href="http://lotusnotessucks.4t.com/">Lotus Notes</a> but that&#8217;s a part of what I&#8217;m doing currently. More specificially I&#8217;m attempting to query Domino via LDAP with a VBS script. It turns out that this is a fairly simple process and you can use the Active Directory Provider built into Windows.</p>
<p>The TechNet script centre has a <a href="http://http://www.microsoft.com/technet/scriptcenter/resources/tales/sg0405.mspx" class="broken_link">two-part</a>, <a href="http://www.microsoft.com/technet/scriptcenter/resources/tales/sg0505.mspx">detailed article</a> on how to query Active Directory which is a great resource for this type of query. Here a script I&#8217;ve used to query Notes for user objects and return their e-mail addresses. The LDAP query includes a server name so that it will connect to a specific server. This will attempt an anonymous query so you will have to extend this script to make an authenticated query.</p>
<pre class="brush: vb; title: ; notranslate">Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject(&quot;ADODB.Connection&quot;)
Set objCommand =   CreateObject(&quot;ADODB.Command&quot;)
objConnection.Provider = &quot;ADsDSOObject&quot;
objConnection.Open &quot;Active Directory Provider&quot;
Set objCommand.ActiveConnection = objConnection
objCommand.Properties(&quot;Page Size&quot;) = 1000
objCommand.Properties(&quot;Searchscope&quot;) = ADS_SCOPE_SUBTREE

WScript.Echo &quot;Executing LDAP query..&quot;
objCommand.CommandText = &quot;SELECT * FROM 'LDAP://server/o=org' WHERE objectClass='dominoPerson' AND mail='*'&quot;
Set objRecordSet = objCommand.Execute
WScript.Echo &quot;Query complete. Found &quot; &amp; objRecordSet.RecordCount &amp; &quot; objects.&quot;

objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Set objUser = GetObject(objRecordSet.Fields(&quot;ADsPath&quot;).Value)
WScript.Echo objUser.mail
objRecordSet.MoveNext
Loop</pre>
<p>You can also find information and example for querying 3rd party LDAP servers with ADSI in these knowledgebase articles:</p>
<ul>
<li><a href="http://support.microsoft.com/kb/q251195/">INFO: How to Use ADSI to Query a Third-Party LDAP Server</a></li>
<li><a href="http://support.microsoft.com/kb/223049/EN-US/">How To Query Exchange 5.x Anonymously Through ADSI</a></li>
</ul>
<p>Here&#8217;s a function that uses a different query method that will return an array of user distinguished names based on the search string passed to it. For example, if you pass the following string &#8220;OU=Sales,O=DominoOrg&#8221; it will only return users in the Sales OU below the DominoOrg organisation:</p>
<pre class="brush: vb; title: ; notranslate">'Return the distinguished name of all of the user objects below the specified organisation
Function fReturnDominoDNs(sDominoServer, sDominoScope)
Dim aArray()
Dim i: i = 0

Set oConnection = CreateObject(&quot;ADODB.Connection&quot;)
Set oRecordset = CreateObject(&quot;ADODB.Recordset&quot;)
Set oCommand = CreateObject(&quot;ADODB.Command&quot;)

oConnection.Provider = &quot;ADsDSOObject&quot;
oConnection.Properties(&quot;User ID&quot;) = &quot;&quot;
oConnection.Properties(&quot;Password&quot;) = &quot;&quot;
oConnection.Properties(&quot;Encrypt Password&quot;) = False
oConnection.Open &quot;ADs Provider&quot;
oCommand.ActiveConnection = oConnection
oCommand.Properties(&quot;Page Size&quot;) = 1000

'Output of query looks like this: GC://server:389/CN=Joe Blogs,OU=Sales,O=DominoOrg
oCommand.CommandText = &quot;&lt;gc:&gt;;(objectClass=dominoPerson);*;subtree&quot;
Set oRecordset = oCommand.Execute&lt;/gc:&gt;

If oRecordSet.RecordCount &lt;&gt; 0 Then
oRecordSet.MoveFirst
Do Until oRecordSet.EOF
If InStr(oRecordset.Fields(&quot;ADsPath&quot;).Value, sDominoScope) Then
ReDim Preserve aArray(i)
aArray(i) = Right(oRecordSet.Fields(&quot;ADsPath&quot;).Value, Len(oRecordSet.Fields(&quot;ADsPath&quot;).Value)-Instr(Len(&quot;GC://&quot; &amp; sDominoServer &amp; &quot;:389&quot;), oRecordSet.Fields(&quot;ADsPath&quot;).Value, &quot;CN=&quot;)+1)
i = i + 1
End If
oRecordset.MoveNext
Loop
End If
fDominoUserDNs = aArray
Set oConnection = Nothing
Set oCommand =   Nothing
Set oRecordset = Nothing
End Function</pre>
<p><div style="padding: 5px 5px 5px 5px; border: 1px solid #cccccc; color: #303030; background-color: #f4f4f4;"><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" style="float:left;margin-right:5px;border:0px;" /></a><a href="http://blog.stealthpuppy.com/scripting/quering-domino-via-ldap-with-vbscript/">Quering Domino via LDAP with VBscript</a>  is post from <a href="http://blog.stealthpuppy.com/">stealthpuppy.com</a>.  Except as noted otherwise, this work is &copy; 2005-2012 Aaron Parker and is licensed under a <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>.</div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.stealthpuppy.com/scripting/quering-domino-via-ldap-with-vbscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

