<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Alfa BBT &#187; Scripting</title>
	<atom:link href="http://blog.koenvermoesen.be/category/tech/scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.koenvermoesen.be</link>
	<description>Allways looking for a better Blog Title...</description>
	<lastBuildDate>Tue, 13 Jul 2010 09:33:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.koenvermoesen.be' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/72db48a689a5327f7bba8c9193cac8af?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Alfa BBT &#187; Scripting</title>
		<link>http://blog.koenvermoesen.be</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.koenvermoesen.be/osd.xml" title="Alfa BBT" />
	<atom:link rel='hub' href='http://blog.koenvermoesen.be/?pushpress=hub'/>
		<item>
		<title>Command Based Help Gotcha</title>
		<link>http://blog.koenvermoesen.be/2010/05/20/command-based-help-gotcha-2/</link>
		<comments>http://blog.koenvermoesen.be/2010/05/20/command-based-help-gotcha-2/#comments</comments>
		<pubDate>Thu, 20 May 2010 20:57:06 +0000</pubDate>
		<dc:creator>Koen Vermoesen</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">https://k0v3.wordpress.com/?p=1036</guid>
		<description><![CDATA[I’ve had the chance to play around with some PowerShell scripting again. A nice occasion to try and include some Comment Based Help I read about in TechNet Magazine a couple of months ago. However I couldn’t get it to work in combination with the standard script header template I tend to use for all [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=1036&subd=k0v3&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I’ve had the chance to play around with some PowerShell scripting again. A nice occasion to try and include some Comment Based Help I read about in <a title="WTFM: Writing the Fabulous Manual" href="http://technet.microsoft.com/en-us/magazine/ff458353.aspx">TechNet Magazine</a> a couple of months ago. However I couldn’t get it to work in combination with the standard script header template I tend to use for all of my scripts.</p>
<p>I experimented with commenting out each line on its own:</p>
<pre class="brush: powershell;">
#header
#
#help
</pre>
<p>or using comment blocks</p>
<pre class="brush: powershell;">
&lt;#
header
help
#&gt;
</pre>
<p>even</p>
<pre class="brush: powershell;">
&lt;#
header
#&gt;
&lt;#
help
#&gt;
</pre>
<p>and a couple more variations, but no joy. After some “binging” I ended up reading <a title="about_Comment_Based_Help" href="Writing the Fabulous Manual">about_Comment_Based_Help</a>;</p>
<blockquote><p>All of the lines in a comment-based Help topic must be contiguous. If a comment-based Help topic follows a comment that is not part of the Help topic, there must be at least one blank line between the last non-Help comment line and the beginning of the comment-based Help.</p></blockquote>
<p>It still took some more trial and error to realize that an “empty line” well, needs to be really empty. It cannot contain a comment character either! Call me stupid ;-)</p>
<p>Here’s an example of how it should be done (Ref. line 22):</p>
<pre class="brush: powershell; highlight: [22]; wrap-lines: true;">
#========================================================================================================
# AUTHOR
# Koen Vermoesen
# ***.***@***.***
# 2010-05-20
#========================================================================================================
# SCRIPT
# Create custom address lists based on a CSV file
#========================================================================================================
# PREREQUISITES
# /
#========================================================================================================
# CHANGE HISTORY:
# 2010-05-10 Initial version
#========================================================================================================
# TO DO
# /
#========================================================================================================
# COMMENTS
# Parent lists need to proceed child lists in your input csv-file!
#========================================================================================================

#.SYNOPSIS
#Create custom address lists
#
#.DESCRIPTION
#Create custom address lists based on a CSV file called &amp;quot;CreateAddressLists.csv&amp;quot; with these columns
# - Name
# - Container
# - RecipientFilter
#The script will check if the &quot;Container&quot;-field is empty and run de cmdlet with or without &quot;-container&quot; option
#
#.Link
#http://technet.microsoft.com/en-us/library/aa996912.aspx

$Input = &quot;CreateAddressLists.csv&quot;
Import-CSV $Input | Foreach { If ($_.Container -eq &quot;&quot;) {New-AddressList -Name $_.Name -RecipientFilter $_.RecipientFilter} else {New-AddressList -Name $_.Name -Container $_.Container -RecipientFilter $_.RecipientFilter}}
</pre>
<p>For those of you wondering, I have the habit of using scripts not just for bulky or repetitive actions but also as means of documentation and standardization. Additionally these scripts come in handy If you ever need to rebuild some part of the infrastructure. Hence the 35 lines of comment for only 2 lines of code.</p>
<br />Filed under: <a href='http://blog.koenvermoesen.be/category/tech/scripting/'>Scripting</a> Tagged: <a href='http://blog.koenvermoesen.be/tag/powershell/'>PowerShell</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k0v3.wordpress.com/1036/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k0v3.wordpress.com/1036/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k0v3.wordpress.com/1036/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k0v3.wordpress.com/1036/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k0v3.wordpress.com/1036/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k0v3.wordpress.com/1036/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k0v3.wordpress.com/1036/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k0v3.wordpress.com/1036/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k0v3.wordpress.com/1036/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k0v3.wordpress.com/1036/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=1036&subd=k0v3&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.koenvermoesen.be/2010/05/20/command-based-help-gotcha-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f646bcfc3f7534b20fa79e0347353eb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">k0v3</media:title>
		</media:content>
	</item>
		<item>
		<title>PowerCLI autocompletion for Notepad++</title>
		<link>http://blog.koenvermoesen.be/2010/05/06/powercli-autocompletion-for-notepad/</link>
		<comments>http://blog.koenvermoesen.be/2010/05/06/powercli-autocompletion-for-notepad/#comments</comments>
		<pubDate>Thu, 06 May 2010 14:14:35 +0000</pubDate>
		<dc:creator>Stijn Vermoesen</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Notepad++]]></category>
		<category><![CDATA[PowerCLI]]></category>

		<guid isPermaLink="false">https://k0v3.wordpress.com/?p=1014</guid>
		<description><![CDATA[Notepad++ supports Powershell from version v5.6 but the VMware PowerCLI cmdlets aren&#8217;t included. So I created PowerCLI Language definition file for syntax highlighting. It contains the cmdlets available in vSphere PowerCLI 4 Update 1 and vCenter Update Manager PowerCLI 4 Update 1. &#60;NotepadPlus&#62; &#60;UserLang name=&#34;PowerCLI&#34; ext=&#34;ps1&#34;&#62; &#60;Settings&#62; &#60;Global caseIgnored=&#34;yes&#34; /&#62; &#60;TreatAsSymbol comment=&#34;no&#34; commentLine=&#34;no&#34; /&#62; &#60;Prefix [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=1014&subd=k0v3&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Notepad++ supports Powershell from version v5.6 but the VMware PowerCLI cmdlets aren&#8217;t included.</p>
<p>So I created PowerCLI Language definition file for syntax highlighting. It contains the cmdlets available in vSphere PowerCLI 4 Update 1 and vCenter Update Manager PowerCLI 4 Update 1.</p>
<pre class="brush: xml; wrap-lines: false;">
&lt;NotepadPlus&gt;
    &lt;UserLang name=&quot;PowerCLI&quot; ext=&quot;ps1&quot;&gt;
        &lt;Settings&gt;
            &lt;Global caseIgnored=&quot;yes&quot; /&gt;
            &lt;TreatAsSymbol comment=&quot;no&quot; commentLine=&quot;no&quot; /&gt;
            &lt;Prefix words1=&quot;yes&quot; words2=&quot;yes&quot; words3=&quot;no&quot; words4=&quot;no&quot; /&gt;
        &lt;/Settings&gt;
        &lt;KeywordLists&gt;
            &lt;Keywords name=&quot;Delimiters&quot;&gt;000000&lt;/Keywords&gt;
            &lt;Keywords name=&quot;Folder+&quot;&gt;&lt;/Keywords&gt;
            &lt;Keywords name=&quot;Folder-&quot;&gt;&lt;/Keywords&gt;
            &lt;Keywords name=&quot;Operators&quot;&gt;&lt;/Keywords&gt;
            &lt;Keywords name=&quot;Comment&quot;&gt;&lt;/Keywords&gt;
            &lt;Keywords name=&quot;Words1&quot;&gt;Add-PassthroughDevice Add-VMHost Add-VmHostNtpServer Apply-DrsRecommendation Apply-VMHostProfile Connect-VIServer Copy-DatastoreItem Copy-HardDisk Copy-VMGuestFile Disconnect-VIServer Dismount-Tools Export-VApp Export-VMHostProfile Get-Annotation Get-CDDrive Get-Cluster Get-CustomAttribute Get-Datacenter Get-Datastore Get-DrsRecommendation Get-DrsRule Get-FloppyDrive Get-Folder Get-HardDisk Get-Inventory Get-IScsiHbaTarget Get-Log Get-LogType Get-NetworkAdapter Get-NicTeamingPolicy Get-OSCustomizationNicMapping Get-OSCustomizationSpec Get-PassthroughDevice Get-PowerCLIConfiguration Get-PowerCLIVersion Get-ResourcePool Get-ScsiLun Get-ScsiLunPath Get-Snapshot Get-Stat Get-StatInterval Get-StatType Get-Task Get-Template Get-UsbDevice Get-VApp Get-VICredentialStoreItem Get-VIEvent Get-View Get-VIObjectByVIView Get-VIPermission Get-VIPrivilege Get-VIRole Get-VirtualPortGroup Get-VirtualSwitch Get-VM Get-VMGuest Get-VMGuestNetworkInterface Get-VMGuestRoute Get-VMHost Get-VMHostAccount Get-VMHostAdvancedConfiguration Get-VMHostAvailableTimeZone Get-VMHostDiagnosticPartition Get-VMHostFirewallDefaultPolicy Get-VMHostFirewallException Get-VMHostFirmware Get-VMHostHba Get-VMHostModule Get-VMHostNetwork Get-VMHostNetworkAdapter Get-VMHostNtpServer Get-VMHostProfile Get-VMHostService Get-VMHostSnmp Get-VMHostStartPolicy Get-VMHostStorage Get-VMHostSysLogServer Get-VMQuestion Get-VMResourceConfiguration Get-VMStartPolicy Import-VApp Import-VMHostProfile Install-VMHostPatch Invoke-VMScript Mount-Tools Move-Cluster Move-Datacenter Move-Folder Move-Inventory Move-ResourcePool Move-Template Move-VM Move-VMHostNew-CDDrive New-ClusterNew-CustomAttribute New-CustomField New-Datacenter New-Datastore New-DrsRule New-FloppyDrive New-Folder New-HardDisk New-IScsiHbaTarget New-NetworkAdapter New-OSCustomizationNicMapping New-OSCustomizationSpec New-ResourcePool New-Snapshot New-StatInterval New-Template New-VApp New-VICredentialStoreItem New-VIPermission New-VIRole New-VirtualPortGroup New-VirtualSwitch New-VM New-VMGuestRoute New-VMHostAccount New-VMHostNetworkAdapter New-VMHostProfile Remove-CDDrive Remove-Cluster Remove-CustomAttribute Remove-CustomField Remove-Datacenter Remove-Datastore Remove-DrsRule Remove-FloppyDrive Remove-Folder Remove-HardDisk Remove-Inventory Remove-IScsiHbaTarget Remove-NetworkAdapter Remove-OSCustomizationNicMap... Remove-OSCustomizationSpec Remove-PassthroughDevice Remove-ResourcePool Remove-Snapshot Remove-StatInterval Remove-Template Remove-UsbDevice Remove-VApp Remove-VICredentialStoreItem Remove-VIPermission Remove-VIRole Remove-VirtualPortGroup Remove-VirtualSwitch Remove-VM Remove-VMGuestRoute Remove-VMHost Remove-VMHostAccount Remove-VMHostNetworkAdapter Remove-VMHostNtpServer Remove-VMHostProfile Restart-VM Restart-VMGuest Restart-VMHost Restart-VMHostService Set-Annotation Set-CDDrive Set-Cluster Set-CustomAttribute Set-CustomField Set-Datacenter Set-Datastore Set-DrsRule Set-FloppyDrive Set-Folder Set-HardDisk Set-IScsiHbaTarget Set-NetworkAdapter Set-NicTeamingPolicy Set-OSCustomizationNicMapping Set-OSCustomizationSpec Set-PowerCLIConfiguration Set-ResourcePool Set-ScsiLun Set-ScsiLunPath Set-Snapshot Set-StatInterval Set-Template Set-VApp Set-VIPermission Set-VIRole Set-VirtualPortGroup Set-VirtualSwitch Set-VM Set-VMGuestNetworkInterface Set-VMGuestRoute Set-VMHost Set-VMHostAccount Set-VMHostAdvancedConfiguration Set-VMHostDiagnosticPartition Set-VMHostFirewallDefaultPolicy Set-VMHostFirewallException Set-VMHostFirmware Set-VMHostHba Set-VMHostModule Set-VMHostNetwork Set-VMHostNetworkAdapter Set-VMHostProfile Set-VMHostService Set-VMHostSnmp Set-VMHostStartPolicy Set-VMHostStorage Set-VMHostSysLogServer Set-VMQuestion Set-VMResourceConfiguration Set-VMStartPolicy Shutdown-VMGuest Start-VApp Start-VM Start-VMHost Start-VMHostService Stop-Task Stop-VApp Stop-VM Stop-VMHost Stop-VMHostService Suspend-VM Suspend-VMGuest Suspend-VMHost Test-VMHostProfileCompliance Test-VMHostSnmp Update-Tools Wait-Task Attach-Baseline Detach-Baseline Download-Patch Get-Baseline Get-Compliance Get-Patch Get-PatchBaseline New-PatchBaseline Remediate-Inventory Remove-Baseline Scan-Inventory Set-PatchBaseline Stage-Patch&lt;/Keywords&gt;
            &lt;Keywords name=&quot;Words2&quot;&gt;Answer-VMQuestion Get-ESX Get-PowerCLIDocumentation Get-VC Get-VIServer Get-VIToolkitConfiguration Get-VIToolkitVersion Set-VIToolkitConfiguration&lt;/Keywords&gt;
            &lt;Keywords name=&quot;Words3&quot;&gt;&lt;/Keywords&gt;
            &lt;Keywords name=&quot;Words4&quot;&gt;&lt;/Keywords&gt;
        &lt;/KeywordLists&gt;
        &lt;Styles&gt;
            &lt;WordsStyle name=&quot;DEFAULT&quot; styleID=&quot;11&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;FOLDEROPEN&quot; styleID=&quot;12&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;FOLDERCLOSE&quot; styleID=&quot;13&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;KEYWORD1&quot; styleID=&quot;5&quot; fgColor=&quot;0000FF&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;1&quot; /&gt;
            &lt;WordsStyle name=&quot;KEYWORD2&quot; styleID=&quot;6&quot; fgColor=&quot;8080FF&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;KEYWORD3&quot; styleID=&quot;7&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;KEYWORD4&quot; styleID=&quot;8&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;COMMENT&quot; styleID=&quot;1&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;COMMENT LINE&quot; styleID=&quot;2&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;NUMBER&quot; styleID=&quot;4&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;OPERATOR&quot; styleID=&quot;10&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;DELIMINER1&quot; styleID=&quot;14&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;DELIMINER2&quot; styleID=&quot;15&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
            &lt;WordsStyle name=&quot;DELIMINER3&quot; styleID=&quot;16&quot; fgColor=&quot;000000&quot; bgColor=&quot;FFFFFF&quot; fontName=&quot;&quot; fontStyle=&quot;0&quot; /&gt;
        &lt;/Styles&gt;
    &lt;/UserLang&gt;
&lt;/NotepadPlus&gt;
</pre>
<p>To add PowerCLI as a user-defined language %APPDATA%\Notepad++\userDefineLang.xml and add the above configuration to this file.</p>
<p>Secondly I created a PowerCLI auto-completion file which contains the same PowerCLI cmdlets. This configuration needs to be added to C:\Program Files\Notepad++\plugins\APIs\PowerCLI.xml. The name of the auto-completion file needs to be the same as defined in the user-defined language definition file.</p>
<pre class="brush: xml; wrap-lines: false;">
&lt;NotepadPlus&gt;
	&lt;AutoComplete&gt;
		&lt;KeyWord name=&quot;Add-PassthroughDevice&quot;/&gt;
		&lt;KeyWord name=&quot;Add-VMHost&quot;/&gt;
		&lt;KeyWord name=&quot;Add-VmHostNtpServer&quot;/&gt;
		&lt;KeyWord name=&quot;Answer-VMQuestion&quot;/&gt;
		&lt;KeyWord name=&quot;Apply-DrsRecommendation&quot;/&gt;
		&lt;KeyWord name=&quot;Apply-VMHostProfile&quot;/&gt;
		&lt;KeyWord name=&quot;Attach-Baseline&quot;/&gt;
		&lt;KeyWord name=&quot;Connect-VIServer&quot;/&gt;
		&lt;KeyWord name=&quot;Copy-DatastoreItem&quot;/&gt;
		&lt;KeyWord name=&quot;Copy-HardDisk&quot;/&gt;
		&lt;KeyWord name=&quot;Copy-VMGuestFile&quot;/&gt;
		&lt;KeyWord name=&quot;Detach-Baseline&quot;/&gt;
		&lt;KeyWord name=&quot;Disconnect-VIServer&quot;/&gt;
		&lt;KeyWord name=&quot;Dismount-Tools&quot;/&gt;
		&lt;KeyWord name=&quot;Download-Patch&quot;/&gt;
		&lt;KeyWord name=&quot;Export-VApp&quot;/&gt;
		&lt;KeyWord name=&quot;Export-VMHostProfile&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Annotation&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Baseline&quot;/&gt;
		&lt;KeyWord name=&quot;Get-CDDrive&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Cluster&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Compliance&quot;/&gt;
		&lt;KeyWord name=&quot;Get-CustomAttribute&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Datacenter&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Datastore&quot;/&gt;
		&lt;KeyWord name=&quot;Get-DrsRecommendation&quot;/&gt;
		&lt;KeyWord name=&quot;Get-DrsRule&quot;/&gt;
		&lt;KeyWord name=&quot;Get-ESX&quot;/&gt;
		&lt;KeyWord name=&quot;Get-FloppyDrive&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Folder&quot;/&gt;
		&lt;KeyWord name=&quot;Get-HardDisk&quot;/&gt;
		&lt;KeyWord name=&quot;Get-IScsiHbaTarget&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Inventory&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Log&quot;/&gt;
		&lt;KeyWord name=&quot;Get-LogType&quot;/&gt;
		&lt;KeyWord name=&quot;Get-NetworkAdapter&quot;/&gt;
		&lt;KeyWord name=&quot;Get-NicTeamingPolicy&quot;/&gt;
		&lt;KeyWord name=&quot;Get-OSCustomizationNicMapping&quot;/&gt;
		&lt;KeyWord name=&quot;Get-OSCustomizationSpec&quot;/&gt;
		&lt;KeyWord name=&quot;Get-PassthroughDevice&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Patch&quot;/&gt;
		&lt;KeyWord name=&quot;Get-PatchBaseline&quot;/&gt;
		&lt;KeyWord name=&quot;Get-PowerCLIConfiguration&quot;/&gt;
		&lt;KeyWord name=&quot;Get-PowerCLIDocumentation&quot;/&gt;
		&lt;KeyWord name=&quot;Get-PowerCLIVersion&quot;/&gt;
		&lt;KeyWord name=&quot;Get-ResourcePool&quot;/&gt;
		&lt;KeyWord name=&quot;Get-ScsiLun&quot;/&gt;
		&lt;KeyWord name=&quot;Get-ScsiLunPath&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Snapshot&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Stat&quot;/&gt;
		&lt;KeyWord name=&quot;Get-StatInterval&quot;/&gt;
		&lt;KeyWord name=&quot;Get-StatType&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Task&quot;/&gt;
		&lt;KeyWord name=&quot;Get-Template&quot;/&gt;
		&lt;KeyWord name=&quot;Get-UsbDevice&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VApp&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VC&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VICredentialStoreItem&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VIEvent&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VIObjectByVIView&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VIPermission&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VIPrivilege&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VIRole&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VIServer&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VIToolkitConfiguration&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VIToolkitVersion&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VM&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMGuest&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMGuestNetworkInterface&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMGuestRoute&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHost&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostAccount&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostAdvancedConfiguration&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostAvailableTimeZone&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostDiagnosticPartition&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostFirewallDefaultPolicy&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostFirewallException&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostFirmware&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostHba&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostModule&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostNetwork&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostNetworkAdapter&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostNtpServer&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostProfile&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostService&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostSnmp&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostStartPolicy&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostStorage&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMHostSysLogServer&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMQuestion&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMResourceConfiguration&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VMStartPolicy&quot;/&gt;
		&lt;KeyWord name=&quot;Get-View&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VirtualPortGroup&quot;/&gt;
		&lt;KeyWord name=&quot;Get-VirtualSwitch&quot;/&gt;
		&lt;KeyWord name=&quot;Import-VApp&quot;/&gt;
		&lt;KeyWord name=&quot;Import-VMHostProfile&quot;/&gt;
		&lt;KeyWord name=&quot;Install-VMHostPatch&quot;/&gt;
		&lt;KeyWord name=&quot;Invoke-VMScript&quot;/&gt;
		&lt;KeyWord name=&quot;Mount-Tools&quot;/&gt;
		&lt;KeyWord name=&quot;Move-Cluster&quot;/&gt;
		&lt;KeyWord name=&quot;Move-Datacenter&quot;/&gt;
		&lt;KeyWord name=&quot;Move-Folder&quot;/&gt;
		&lt;KeyWord name=&quot;Move-Inventory&quot;/&gt;
		&lt;KeyWord name=&quot;Move-ResourcePool&quot;/&gt;
		&lt;KeyWord name=&quot;Move-Template&quot;/&gt;
		&lt;KeyWord name=&quot;Move-VM&quot;/&gt;
		&lt;KeyWord name=&quot;Move-VMHost&quot;/&gt;
		&lt;KeyWord name=&quot;New-CDDrive&quot;/&gt;
		&lt;KeyWord name=&quot;New-Cluster&quot;/&gt;
		&lt;KeyWord name=&quot;New-CustomAttribute&quot;/&gt;
		&lt;KeyWord name=&quot;New-CustomField&quot;/&gt;
		&lt;KeyWord name=&quot;New-Datacenter&quot;/&gt;
		&lt;KeyWord name=&quot;New-Datastore&quot;/&gt;
		&lt;KeyWord name=&quot;New-DrsRule&quot;/&gt;
		&lt;KeyWord name=&quot;New-FloppyDrive&quot;/&gt;
		&lt;KeyWord name=&quot;New-Folder&quot;/&gt;
		&lt;KeyWord name=&quot;New-HardDisk&quot;/&gt;
		&lt;KeyWord name=&quot;New-IScsiHbaTarget&quot;/&gt;
		&lt;KeyWord name=&quot;New-NetworkAdapter&quot;/&gt;
		&lt;KeyWord name=&quot;New-OSCustomizationNicMapping&quot;/&gt;
		&lt;KeyWord name=&quot;New-OSCustomizationSpec&quot;/&gt;
		&lt;KeyWord name=&quot;New-PatchBaseline&quot;/&gt;
		&lt;KeyWord name=&quot;New-ResourcePool&quot;/&gt;
		&lt;KeyWord name=&quot;New-Snapshot&quot;/&gt;
		&lt;KeyWord name=&quot;New-StatInterval&quot;/&gt;
		&lt;KeyWord name=&quot;New-Template&quot;/&gt;
		&lt;KeyWord name=&quot;New-VApp&quot;/&gt;
		&lt;KeyWord name=&quot;New-VICredentialStoreItem&quot;/&gt;
		&lt;KeyWord name=&quot;New-VIPermission&quot;/&gt;
		&lt;KeyWord name=&quot;New-VIRole&quot;/&gt;
		&lt;KeyWord name=&quot;New-VM&quot;/&gt;
		&lt;KeyWord name=&quot;New-VMGuestRoute&quot;/&gt;
		&lt;KeyWord name=&quot;New-VMHostAccount&quot;/&gt;
		&lt;KeyWord name=&quot;New-VMHostNetworkAdapter&quot;/&gt;
		&lt;KeyWord name=&quot;New-VMHostProfile&quot;/&gt;
		&lt;KeyWord name=&quot;New-VirtualPortGroup&quot;/&gt;
		&lt;KeyWord name=&quot;New-VirtualSwitch&quot;/&gt;
		&lt;KeyWord name=&quot;Remediate-Inventory&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-Baseline&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-CDDrive&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-Cluster&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-CustomAttribute&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-CustomField&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-Datacenter&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-Datastore&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-DrsRule&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-FloppyDrive&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-Folder&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-HardDisk&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-IScsiHbaTarget&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-Inventory&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-NetworkAdapter&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-OSCustomizationNicMap...&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-OSCustomizationSpec&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-PassthroughDevice&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-ResourcePool&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-Snapshot&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-StatInterval&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-Template&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-UsbDevice&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VApp&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VICredentialStoreItem&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VIPermission&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VIRole&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VM&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VMGuestRoute&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VMHost&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VMHostAccount&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VMHostNetworkAdapter&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VMHostNtpServer&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VMHostProfile&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VirtualPortGroup&quot;/&gt;
		&lt;KeyWord name=&quot;Remove-VirtualSwitch&quot;/&gt;
		&lt;KeyWord name=&quot;Restart-VM&quot;/&gt;
		&lt;KeyWord name=&quot;Restart-VMGuest&quot;/&gt;
		&lt;KeyWord name=&quot;Restart-VMHost&quot;/&gt;
		&lt;KeyWord name=&quot;Restart-VMHostService&quot;/&gt;
		&lt;KeyWord name=&quot;Scan-Inventory&quot;/&gt;
		&lt;KeyWord name=&quot;Set-Annotation&quot;/&gt;
		&lt;KeyWord name=&quot;Set-CDDrive&quot;/&gt;
		&lt;KeyWord name=&quot;Set-Cluster&quot;/&gt;
		&lt;KeyWord name=&quot;Set-CustomAttribute&quot;/&gt;
		&lt;KeyWord name=&quot;Set-CustomField&quot;/&gt;
		&lt;KeyWord name=&quot;Set-Datacenter&quot;/&gt;
		&lt;KeyWord name=&quot;Set-Datastore&quot;/&gt;
		&lt;KeyWord name=&quot;Set-DrsRule&quot;/&gt;
		&lt;KeyWord name=&quot;Set-FloppyDrive&quot;/&gt;
		&lt;KeyWord name=&quot;Set-Folder&quot;/&gt;
		&lt;KeyWord name=&quot;Set-HardDisk&quot;/&gt;
		&lt;KeyWord name=&quot;Set-IScsiHbaTarget&quot;/&gt;
		&lt;KeyWord name=&quot;Set-NetworkAdapter&quot;/&gt;
		&lt;KeyWord name=&quot;Set-NicTeamingPolicy&quot;/&gt;
		&lt;KeyWord name=&quot;Set-OSCustomizationNicMapping&quot;/&gt;
		&lt;KeyWord name=&quot;Set-OSCustomizationSpec&quot;/&gt;
		&lt;KeyWord name=&quot;Set-PatchBaseline&quot;/&gt;
		&lt;KeyWord name=&quot;Set-PowerCLIConfiguration&quot;/&gt;
		&lt;KeyWord name=&quot;Set-ResourcePool&quot;/&gt;
		&lt;KeyWord name=&quot;Set-ScsiLun&quot;/&gt;
		&lt;KeyWord name=&quot;Set-ScsiLunPath&quot;/&gt;
		&lt;KeyWord name=&quot;Set-Snapshot&quot;/&gt;
		&lt;KeyWord name=&quot;Set-StatInterval&quot;/&gt;
		&lt;KeyWord name=&quot;Set-Template&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VApp&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VIPermission&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VIRole&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VM&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMGuestNetworkInterface&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMGuestRoute&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHost&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostAccount&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostAdvancedConfiguration&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostDiagnosticPartition&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostFirewallDefaultPolicy&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostFirewallException&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostFirmware&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostHba&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostModule&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostNetwork&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostNetworkAdapter&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostProfile&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostService&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostSnmp&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostStartPolicy&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostStorage&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMHostSysLogServer&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMQuestion&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMResourceConfiguration&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VMStartPolicy&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VirtualPortGroup&quot;/&gt;
		&lt;KeyWord name=&quot;Set-VirtualSwitch&quot;/&gt;
		&lt;KeyWord name=&quot;Shutdown-VMGuest&quot;/&gt;
		&lt;KeyWord name=&quot;Stage-Patch&quot;/&gt;
		&lt;KeyWord name=&quot;Start-VApp&quot;/&gt;
		&lt;KeyWord name=&quot;Start-VM&quot;/&gt;
		&lt;KeyWord name=&quot;Start-VMHost&quot;/&gt;
		&lt;KeyWord name=&quot;Start-VMHostService&quot;/&gt;
		&lt;KeyWord name=&quot;Stop-Task&quot;/&gt;
		&lt;KeyWord name=&quot;Stop-VApp&quot;/&gt;
		&lt;KeyWord name=&quot;Stop-VM&quot;/&gt;
		&lt;KeyWord name=&quot;Stop-VMHost&quot;/&gt;
		&lt;KeyWord name=&quot;Stop-VMHostService&quot;/&gt;
		&lt;KeyWord name=&quot;Suspend-VM&quot;/&gt;
		&lt;KeyWord name=&quot;Suspend-VMGuest&quot;/&gt;
		&lt;KeyWord name=&quot;Suspend-VMHost&quot;/&gt;
		&lt;KeyWord name=&quot;Test-VMHostProfileCompliance&quot;/&gt;
		&lt;KeyWord name=&quot;Test-VMHostSnmp&quot;/&gt;
		&lt;KeyWord name=&quot;Update-Tools&quot;/&gt;
		&lt;KeyWord name=&quot;Wait-Task &quot;/&gt;
	&lt;/AutoComplete&gt;
&lt;/NotepadPlus&gt;
</pre>
<br />Filed under: <a href='http://blog.koenvermoesen.be/category/powershell/'>PowerShell</a>, <a href='http://blog.koenvermoesen.be/category/tech/scripting/'>Scripting</a>, <a href='http://blog.koenvermoesen.be/category/tech/virtualization/'>Virtualization</a> Tagged: <a href='http://blog.koenvermoesen.be/tag/notepad/'>Notepad++</a>, <a href='http://blog.koenvermoesen.be/tag/powercli/'>PowerCLI</a>, <a href='http://blog.koenvermoesen.be/tag/powershell/'>PowerShell</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k0v3.wordpress.com/1014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k0v3.wordpress.com/1014/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k0v3.wordpress.com/1014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k0v3.wordpress.com/1014/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k0v3.wordpress.com/1014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k0v3.wordpress.com/1014/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k0v3.wordpress.com/1014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k0v3.wordpress.com/1014/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k0v3.wordpress.com/1014/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k0v3.wordpress.com/1014/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=1014&subd=k0v3&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.koenvermoesen.be/2010/05/06/powercli-autocompletion-for-notepad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62aee00de3e0280aadbe38323469a9be?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">sak1n1</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding permissions on printers using powershell</title>
		<link>http://blog.koenvermoesen.be/2009/10/20/adding-permissions-on-printers-using-powershell/</link>
		<comments>http://blog.koenvermoesen.be/2009/10/20/adding-permissions-on-printers-using-powershell/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 14:57:11 +0000</pubDate>
		<dc:creator>Stijn Vermoesen</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://blog.koenvermoesen.be/2009/10/20/adding-permissions-on-printers-using-powershell/</guid>
		<description><![CDATA[I needed to add a group of users to the ACL of all our printers. As we currently have about 100 printers; I looked if I could use powershell for this.Currently on Windows server 2008 there are no built in cmdlets to administrate printers. But I did find a useful powershell script with everything I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=540&subd=k0v3&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I needed to add a group of users to the ACL of all our printers. As we currently have about 100 printers; I looked if I could use powershell for this.<br />Currently on Windows server 2008 there are no built in cmdlets to administrate printers. But I did find a useful powershell script with everything I needed. </p>
<p>I ended up with only executing one line of code to add the group to all the printers.<br />
<blockquote>Get-printer <i>printserver</i> | add-printerpermission -user <i>&#8220;domain\groupname&#8221;</i> -AceType Allow -accessmask ManagePrinters</p></blockquote>
<p>The script can be found <a target="_blank" href="http://translate.google.com/translate?prev=hp&amp;hl=en&amp;u=http%3A%2F%2Fwww.sysadmins.lv%2FPermaLink%2Cguid%2C22c0550d-0c46-44ca-97ce-2b0bccbb51de.aspx&amp;sl=ru&amp;tl=en">here</a>, I&#8217;m posting the google translation link as my Russian isn&#8217;t that good;-)</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=f9b30b23-b6c9-8abc-83bb-d4450f764a78" /></div>
<br />Posted in PowerShell, Scripting  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k0v3.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k0v3.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k0v3.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k0v3.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k0v3.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k0v3.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k0v3.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k0v3.wordpress.com/540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k0v3.wordpress.com/540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k0v3.wordpress.com/540/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=540&subd=k0v3&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.koenvermoesen.be/2009/10/20/adding-permissions-on-printers-using-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62aee00de3e0280aadbe38323469a9be?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">sak1n1</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=f9b30b23-b6c9-8abc-83bb-d4450f764a78" medium="image" />
	</item>
		<item>
		<title>Split CSV to TXT</title>
		<link>http://blog.koenvermoesen.be/2009/10/08/split-csv-to-txt/</link>
		<comments>http://blog.koenvermoesen.be/2009/10/08/split-csv-to-txt/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 16:27:26 +0000</pubDate>
		<dc:creator>Koen Vermoesen</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Batch]]></category>

		<guid isPermaLink="false">http://blog.koenvermoesen.be/?p=530</guid>
		<description><![CDATA[Question: How to split a csv file in one txt file per line? The first column in the CSV provides the name for the TXT-file and the second one the contents. SetLocal EnableDelayedExpansion for /f %%i in (inp.csv) do set var=%%i&#38; set name=!var:~0,6!&#38; set phone=!var:~7,4!&#38; echo !phone!&#62;&#62;!name!.txt EndLocal Posted in Scripting Tagged: Batch<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=530&subd=k0v3&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Question: How to split a csv file in one txt file per line?  The first column in the CSV provides the name for the TXT-file and the second one the contents.</p>
<pre class="brush: plain;">
SetLocal EnableDelayedExpansion
for /f %%i in (inp.csv) do set var=%%i&amp; set name=!var:~0,6!&amp; set phone=!var:~7,4!&amp; echo !phone!&gt;&gt;!name!.txt
EndLocal
</pre>
<br />Posted in Scripting Tagged: Batch <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k0v3.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k0v3.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k0v3.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k0v3.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k0v3.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k0v3.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k0v3.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k0v3.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k0v3.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k0v3.wordpress.com/530/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=530&subd=k0v3&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.koenvermoesen.be/2009/10/08/split-csv-to-txt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f646bcfc3f7534b20fa79e0347353eb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">k0v3</media:title>
		</media:content>
	</item>
		<item>
		<title>ADFind Oneliners</title>
		<link>http://blog.koenvermoesen.be/2009/06/29/adfind-onelines/</link>
		<comments>http://blog.koenvermoesen.be/2009/06/29/adfind-onelines/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 12:51:37 +0000</pubDate>
		<dc:creator>Koen Vermoesen</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[ADFind]]></category>
		<category><![CDATA[LDAP]]></category>

		<guid isPermaLink="false">http://blog.koenvermoesen.be/?p=433</guid>
		<description><![CDATA[I&#8217;m very fond of the powerful AdFind command line utility from joeware.net. Here&#8217;s a little list I&#8217;m keeping for my own reference: Find the user behind a GUID: adfind -binenc -gc -s subtree -b dc=test,dc=com -f &#34;objectGUID={{GUID:????????-????-????-????-????????????}}&#34; displayName Likewise, you can use the same tool to find the e-mail address of a certain user: adfind [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=433&subd=k0v3&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m very fond of the powerful <a href="http://adfind.joeware.net/freetools/tools/adfind/index.htm">AdFind</a> command line utility from <a href="http://blog.joeware.net/">joeware.net</a>. Here&#8217;s a little list I&#8217;m keeping for my own reference:</p>
<p>Find the user behind a GUID:</p>
<pre class="brush: plain;">adfind -binenc -gc -s subtree -b dc=test,dc=com -f &quot;objectGUID={{GUID:????????-????-????-????-????????????}}&quot; displayName</pre>
<p>Likewise, you can use the same tool to find the e-mail address of a certain user:</p>
<pre class="brush: plain; first-line: 2;">adfind -gc -b dc=???,dc=??? -nodn -nolabel -f &quot;sAMAccountName=??????&quot; mail</pre>
<p>The command above is actually part of script, so I used the &#8220;-nodn&#8221; and &#8220;-nolabel&#8221; parameters to have the tool only return the e-mail address. You obviously need to replace the question marks with something meaningful in the examples above.</p>
<p>List all distribution groups:</p>
<pre class="brush: plain; first-line: 3;">adfind -csv -nodn -f &quot;(&amp;(objectcategory=group)(mail=*))&quot; displayname</pre>
<p>List all contacts:</p>
<pre class="brush: plain; first-line: 4;">adfind -csv -nodn -f &quot;(&amp;(&amp;(&amp; (mailnickname=*) (| (&amp;(objectCategory=person)(objectClass=contact)) ))))&quot; displayname</pre>
<p>List all mailbox-enabled users:</p>
<pre class="brush: plain; first-line: 5;">adfind -csv -nodn -f &quot;(&amp;(&amp;(&amp; (mailnickname=*) (| (&amp;(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*))) ))))&quot; displayname</pre>
<p>Run a query against another domain:</p>
<pre class="brush: plain; first-line: 6;">adfind -h %servername% -u %domain%\%username% -up %password% -csv -nodn -f &quot;displayname=John Doe&quot; displayname</pre>
<p>List all the members of a DL (and optionally use the resulting dn to retrieve some more readable information):</p>
<pre class="brush: plain; first-line: 7;">adfind -list -f &quot;DisplayName=%displayname%&quot; member
adfind -list -f &quot;DisplayName=%displayname%&quot; member | adfind -csv -nodn mailnickname displayname mail</pre>
<p>Report on the usage of Extension Attributes:</p>
<pre class="brush: plain; first-line: 9;">adfind -csv -nodn -f &quot;(|(ExtensionAttribute1=*)(ExtensionAttribute2=*)(ExtensionAttribute3=*)(ExtensionAttribute4=*)(ExtensionAttribute5=*)(ExtensionAttribute6=*)(ExtensionAttribute7=*)(ExtensionAttribute8=*)(ExtensionAttribute9=*)(ExtensionAttribute10=*)(ExtensionAttribute11=*)(ExtensionAttribute12=*)(ExtensionAttribute13=*)(ExtensionAttribute14=*)(ExtensionAttribute15=*))&quot; displayname ExtensionAttribute1 ExtensionAttribute2 ExtensionAttribute3 ExtensionAttribute4 ExtensionAttribute5 ExtensionAttribute6 ExtensionAttribute7 ExtensionAttribute8 ExtensionAttribute9 ExtensionAttribute10 ExtensionAttribute11 ExtensionAttribute12 ExtensionAttribute13 ExtensionAttribute14 ExtensionAttribute15</pre>
<p>Count the number of mailboxes on an exchange server:</p>
<pre class="brush: plain; first-line: 10;">adfind -c -f &quot;msExchHomeServerName=/o=EMS/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=%servername%&quot;</pre>
<p>Imagine you&#8217;re working as a consultant/contractor for a large organisation and you want to know the end date of you contract:</p>
<pre class="brush: plain; first-line: 11;">adfind -tdcs -f &quot;samaccountname=%UserName%&quot; accountExpires</pre>
<p>The &#8220;tdcs&#8221; parameter converts the time in a human readable format.</p>
<p>Somebody called you on your mobile phone and you want to know who:</p>
<pre class="brush: plain; first-line: 12;">adfind -list -f &quot;telephoneNumber=*%extension%&quot; displayname</pre>
<p>More info</p>
<ul>
<li><a href="http://www.msexchange.org/articles/Scripting-Exchange-VBScript-ADSI-Part1.html">msexchange.org</a></li>
<li><a href="http://theessentialexchange.com/blogs/michael/archive/2007/11/13/listing-members-of-distribution-lists-and-security-groups.aspx">theessentialexchange.com</a></li>
<li><a href="http://www.petri.co.il/forums/showthread.php?t=17675">petri.co.il</a></li>
<li><a href="http://www.petri.co.il/ldap_search_samples_for_windows_2003_and_exchange.htm">petri.co.il</a></li>
</ul>
<br />Posted in Active Directory, Scripting Tagged: ADFind, LDAP <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k0v3.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k0v3.wordpress.com/433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k0v3.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k0v3.wordpress.com/433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k0v3.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k0v3.wordpress.com/433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k0v3.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k0v3.wordpress.com/433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k0v3.wordpress.com/433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k0v3.wordpress.com/433/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=433&subd=k0v3&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.koenvermoesen.be/2009/06/29/adfind-onelines/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f646bcfc3f7534b20fa79e0347353eb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">k0v3</media:title>
		</media:content>
	</item>
		<item>
		<title>Automating a powershell demo using AutoHotKey</title>
		<link>http://blog.koenvermoesen.be/2009/05/15/automating-a-powershell-demo-using-autohotkey/</link>
		<comments>http://blog.koenvermoesen.be/2009/05/15/automating-a-powershell-demo-using-autohotkey/#comments</comments>
		<pubDate>Fri, 15 May 2009 11:22:11 +0000</pubDate>
		<dc:creator>Koen Vermoesen</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[AutoHotKey]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://blog.koenvermoesen.be/2009/05/15/automating-a-powershell-demo-using-autohotkey</guid>
		<description><![CDATA[I gave a custom Exchange 2007 course to one of our customers yesterday. Not unsurprisingly, it also included a demo of Exchange Management Shell (EMS). These demos tend to end up in a quest for the exact command, which is quite annoying if you&#8217;re in front of an audience (even a small one). Think about: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=324&subd=k0v3&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I gave a custom Exchange 2007 course to one of our customers yesterday. Not unsurprisingly, it also included a demo of Exchange Management Shell (EMS). These demos tend to end up in a quest for the exact command, which is quite annoying if you&#8217;re in front of an audience (even a small one). Think about:</p>
<ul>
<li>about_regular_expressions or about_regular_expression?</li>
<li>$_. or $._?</li>
<li>Why is -Confirm $False not working?</li>
</ul>
<p>This time I decided to try and automate that demo by using the autoreplace feature (Hotstring) in <a href="http://www.autohotkey.com">AutoHotKey</a>. The main goal is avoiding typo&#8217;s by using tried and true commands in a working order. A poor man&#8217;s <a href="http://poshcode.org/705">Start-Demo</a> script if you wish ;-)</p>
<p>The script starts of with a bunch of commands controlling the overall functionallity (the first 3 come with the default template):</p>
<blockquote><p>#NoEnv</p></blockquote>
<p>Recommended for performance and compatibility with future AutoHotkey releases.</p>
<blockquote><p>SendMode Input</p></blockquote>
<p>Recommended for new scripts due to its superior speed and reliability.</p>
<blockquote><p>SetWorkingDir %A_ScriptDir%</p></blockquote>
<p>Ensures a consistent starting directory.</p>
<blockquote><p>#Hotstring EndChars `n</p></blockquote>
<p>Limit the hotstring end characters to ENTER only</p>
<blockquote><p>#Hotstring O</p></blockquote>
<p>Don&#8217;t actually type the end character. (I want to launch the command myself after/during my explanation.)</p>
<blockquote><p>#Hotstring R</p></blockquote>
<p>Type replacement text in raw mode. (To prevent AHK from interpreting e.g. &#8220;{&#8220;)</p>
<p>The remainder of the script is actually a long list of hotstring definitions like these ones</p>
<blockquote><p>::ems01::Get-Help<br />
::ems02::Get-Help About<br />
::ems03::Get-Help About_Regular_Expression<br />
::ems04::Get-Command *mailbox<br />
::ems05::Get-Help New-Mailbox<br />
::ems06::Get-Help New-Mailbox -Detailed<br />
::ems07::Get-Help New-Mailbox -Full</p></blockquote>
<p>and so on.</p>
<p>Seems stupid with these simple examples, but the advantage becomes clear for more complex commands. Lets take &#8220;ems26&#8243; for example;</p>
<blockquote><p>::ems26::1..10 | Foreach-Object { new-mailbox -Database &#8220;Mailbox Database 2&#8243; -Name (&#8220;User&#8221; + $_) -UserPrincipalName (&#8220;User&#8221; + $_ + &#8220;@exchange2007.lab&#8221;) -Password $Pwd }</p></blockquote>
<p>When I type &#8220;ems26&#8243;+ENTER in EMS AutoHotKey executable automatically replaces this string with &#8220;1..10 | Foreach-Object { new-mailbox -Database &#8220;Mailbox Database 2&#8243; -Name (&#8220;User&#8221; + $_) -UserPrincipalName (&#8220;User&#8221; + $_ + &#8220;@exchange2007.lab&#8221;) -Password $Pwd }&#8221; and waits. I do my talking and then hit ENTER again to execute the command.</p>
<p>It worked nicely actually. People were impressed with my typing skills ;-) I only encountered one error because I didn&#8217;t delete some manually after a test the day before. It even works with shell running inside a VM while the AutoHotKey script is running on my physical computer.</p>
<br />Posted in Scripting Tagged: AutoHotKey, PowerShell <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k0v3.wordpress.com/324/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k0v3.wordpress.com/324/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k0v3.wordpress.com/324/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k0v3.wordpress.com/324/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k0v3.wordpress.com/324/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k0v3.wordpress.com/324/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k0v3.wordpress.com/324/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k0v3.wordpress.com/324/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k0v3.wordpress.com/324/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k0v3.wordpress.com/324/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=324&subd=k0v3&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.koenvermoesen.be/2009/05/15/automating-a-powershell-demo-using-autohotkey/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f646bcfc3f7534b20fa79e0347353eb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">k0v3</media:title>
		</media:content>
	</item>
		<item>
		<title>Closing open Lotus Notes file</title>
		<link>http://blog.koenvermoesen.be/2008/11/03/closing-open-lotus-notes-file/</link>
		<comments>http://blog.koenvermoesen.be/2008/11/03/closing-open-lotus-notes-file/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 14:06:46 +0000</pubDate>
		<dc:creator>Koen Vermoesen</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Batch]]></category>
		<category><![CDATA[LotusNotes]]></category>

		<guid isPermaLink="false">http://k0v3.wordpress.com/?p=194</guid>
		<description><![CDATA[The users at a certain customer have a problem with reopening Lotus Notes if their session is not closed properly (e.g. because of a crash of a terminal server). They keep receiving the error message &#8220;Domino Server still running&#8221; until we close the open files. I&#8217;ve been writing a script over time to automate this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=194&subd=k0v3&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>The users at a certain customer have a problem with reopening Lotus Notes if their session is not closed properly (e.g. because of a crash of a terminal server). They keep receiving the error message &#8220;Domino Server still running&#8221; until we close the open files.</p>
<p>I&#8217;ve been writing a script over time to automate this process which becomes quickly annoying after you&#8217;ve done it a couple of times.</p>
<p>More specifically, the script will:</p>
<ol>
<li>Connect to a GC to get domain and display name (ADFind)
<li>Connect to a DC to get home directory (ADFind)
<li>Derive server name from the previous query via string manipulation (Set)
<li>Kill PsExec if it&#8217;s already running (SC)
<li>Find the physical disk (PsExec)
<li>List open Notes files and ask if you whan to close them (PsFile)
<li>Close the files if after you confirmed you wanted to do so (PsFile)
<li>Quit
<li>Last but not least, it will put a comment on the clipboard for easy pasting in the incident management tool ;-) </li>
</ol>
<p>Prerequisites are both <a title="AdFind" href="http://www.joeware.net/freetools/tools/adfind/index.htm">ADFind</a> and <a title="PsTools" href="http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx">PsTools</a>.</p>
<p>Well, here it is:</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;max-height:200px;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> ::========================================================================================================</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> :: AUTHOR</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span> ::    Koen Vermoesen</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span> ::    koen.vermoesen@nospam.com</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span> ::    2008-04-24</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span> ::========================================================================================================</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span> :: SCRIPT</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   8:</span> ::    Close open lotus notes files</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   9:</span> ::========================================================================================================</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  10:</span> :: PREREQUISITES</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  11:</span> ::    ADFind    http:<span style="color:#008000;">//www.joeware.net/freetools/tools/adfind/index.htm</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  12:</span> ::    PsTools    http:<span style="color:#008000;">//technet.microsoft.com/en-us/sysinternals/bb896649.aspx</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  13:</span> ::========================================================================================================</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  14:</span> :: CHANGE HISTORY:</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  15:</span> ::    2008-04-24 Initial version</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  16:</span> ::    2008-04-25 Use %temp% to avoid writing to a network share all the time</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  17:</span> ::    2008-05-07 Added a todo <span style="color:#0000ff;">for</span> the script</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  18:</span> ::    2008-05-13 Call another script to verify &amp; close psexec <span style="color:#0000ff;">if</span> it<span style="color:#006080;">'s already running</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  19:</span> ::    2008-05-13 Goto end (skip closing)  when no open files found</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  20:</span> ::    2008-05-13 Print user'</span>s diplay name <span style="color:#0000ff;">as</span> a means to cross check</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  21:</span> ::    2008-05-14 Removed last reference to temporary file</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  22:</span> ::    2008-07-31 Started <span style="color:#0000ff;">using</span> ADFind to make script work across domains</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  23:</span> ::    2008-07-31 Removed dependency on other scripts <span style="color:#0000ff;">for</span> easy sharing with colleagues</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  24:</span> ::    2008-09-16 Goto end after closing files + use variable <span style="color:#0000ff;">for</span> Title</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  25:</span> ::    2008-10-06 Provide some help when no parameters are being passed</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  26:</span> ::    2008-10-07 Used hardcoded path <span style="color:#0000ff;">for</span> DFS</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  27:</span> ::    2008-10-07 Check <span style="color:#0000ff;">if</span> very first query returns a valid resullt. Jump to help (skip remainder of script) <span style="color:#0000ff;">if</span> not</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  28:</span> ::    2008-10-07 Update Help: hardcoded DFS values + <span style="color:#0000ff;">for</span> loop example <span style="color:#0000ff;">for</span> running against a batch of users</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  29:</span> ::    2008-10-27 Use clip.exe to store some comment on the clipboard <span style="color:#0000ff;">for</span> easy pasting <span style="color:#0000ff;">in</span> the incident</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  30:</span> ::========================================================================================================</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  31:</span> :: TO DO</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  32:</span> ::    Integrate logic <span style="color:#0000ff;">for</span> working on a batch of users.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  33:</span> ::========================================================================================================</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  34:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  35:</span> @echo off</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  36:</span> setlocal EnableDelayedExpansion</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  37:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  38:</span> :: Setting some variables</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  39:</span> Set StrTitle=Close open Lotus Notes files</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  40:</span> Set strHomeDirAB=FileServer01</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  41:</span> Set strHardDiskAB=E:</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  42:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  43:</span> Cls</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  44:</span> Title %StrTitle%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  45:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  46:</span> ::Saving the input parameter to variable</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  47:</span> Set StrUserName=%1</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  48:</span> If <span style="color:#006080;">"[%strUserName%]"</span>==<span style="color:#006080;">"[]"</span> Goto Help</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  49:</span> Set Return=return1</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  50:</span> Goto SubEcho</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  51:</span> :return1</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  52:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  53:</span> :: Looking up Distinguished Name &amp; Display Name</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  54:</span> For /F <span style="color:#006080;">"tokens=1,2 delims=;"</span> %%I <span style="color:#0000ff;">in</span> (<span style="color:#006080;">'adfind -nodn -csv -nocsvheader -csvnoq -csvdelim ^; -gc -s subtree -b dc^=domain^,dc^=tld -f ^"sAMAccountName^=%StrUserName%^" distinguishedName displayName'</span>) Do Set StrDistingName=%%I &amp; Set StrDisplayName=%%J</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  55:</span> If <span style="color:#006080;">"[%StrDisplayName%]"</span>==<span style="color:#006080;">"[]"</span> Echo. &amp; Echo No valid user <span style="color:#0000ff;">object</span> found; please check the username. &amp; Echo. &amp; Goto Help</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  56:</span> Set StrBaseDN=%StrDistingName:~-26%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  57:</span> Set Return=return2</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  58:</span> Goto SubEcho</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  59:</span> :return2</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  60:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  61:</span> :: Looking up Home Directory</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  62:</span> Set StrTLD=%StrBaseDN:~22,3%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  63:</span> Set StrRoot=%StrBaseDN:~15,3%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  64:</span> Set StrDomain=%StrBaseDN:~3,8%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  65:</span> For /F %%I <span style="color:#0000ff;">in</span> (<span style="color:#006080;">'adfind -nodn -csv -nocsvheader -csvnoq -s subtree -b dc^=%StrDomain%^,dc^=%StrRoot%^,dc^=%StrTLD% -f ^"sAMAccountName^=%StrUserName%^" homeDirectory'</span>) Do Set StrHomeDirectory=%%I</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  66:</span> Set Return=return3</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  67:</span> Goto SubEcho</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  68:</span> :return3</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  69:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  70:</span> :: Looking up Home Server</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  71:</span> IF /I <span style="color:#006080;">"%StrDomain%"</span>==<span style="color:#006080;">"subdomain3"</span> (Set StrHomeServer=%strHomeDirAB%) Else (For /F <span style="color:#006080;">"tokens=1 delims=\" %%I in ("</span>%StrHomeDirectory%<span style="color:#006080;">") Do Set StrHomeServer=%%I)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  72:</span> Set Return=return4</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  73:</span> Goto SubEcho</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  74:</span> :return4</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  75:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  76:</span> :: Ensuring PsExec is not running on Home Server</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  77:</span> echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  78:</span> For /F "</span>Tokens=2<span style="color:#006080;">" %%I in ('sc \\%StrHomeServer% query psexesvc ^| find "</span>SERVICE_NAME<span style="color:#006080;">"') Do Set StrPsexecExists=%%I</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  79:</span> If /I "</span>%StrPsexecExists%<span style="color:#006080;">"=="</span>psexesvc<span style="color:#006080;">" (echo PsExec running on the remote host; killing it. &amp; sc \\%StrHomeServer% stop psexesvc &amp; sc \\%StrHomeServer% delete psexesvc) else (echo PsExec is not running on the remote host.)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  80:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  81:</span> :: Looking up Physical Disk</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  82:</span> echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  83:</span> IF /I "</span>%StrDomain%<span style="color:#006080;">"=="</span>subdomain3<span style="color:#006080;">" (Set StrHardDisk=%strHardDiskAB%) Else (For /F "</span>tokens=2 delims=\ <span style="color:#006080;">" %%I in ('psexec \\%StrHomeServer% net share ^| find /i "</span>%StrUserName%<span style="color:#006080;">"') Do Set StrHardDisk=%%I)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  84:</span> Set Return=return5</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  85:</span> Goto SubEcho</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  86:</span> :return5</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  87:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  88:</span> :: Listing open Lotus Notes Files</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  89:</span> IF /I "</span>%StrDomain%<span style="color:#006080;">"=="</span>subdomain1<span style="color:#006080;">" (set StrNotesPath=%StrHardDisk%\folder\%StrUserName%\windows\NotesR6)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  90:</span> IF /I "</span>%StrDomain%<span style="color:#006080;">"=="</span>subdomain2<span style="color:#006080;">" (set StrNotesPath=%StrHardDisk%\folder\folder\%StrUserName%\notes\data)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  91:</span> IF /I "</span>%StrDomain%<span style="color:#006080;">"=="</span>subdomain3<span style="color:#006080;">" (set StrNotesPath=%StrHardDisk%\folder\%StrUserName%\WINDOWS\NotesR6)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  92:</span> Set StrOpenFiles=</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  93:</span> For /F "</span>tokens=2 delims=] <span style="color:#006080;">" %%I in ('psfile \\%StrHomeServer% %StrNotesPath% ^| find /i "</span>] %StrNotesPath%<span style="color:#006080;">"') Do Set StrOpenFiles=!StrOpenFiles!%%I   </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  94:</span> Set Return=return6</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  95:</span> Goto SubEcho</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  96:</span> :return6</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  97:</span> echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  98:</span> IF /I "</span>%StrOpenFiles%<span style="color:#006080;">"=="</span><span style="color:#006080;">" (Echo No open files found. &amp; goto :end)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  99:</span> echo Open Files:</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 100:</span> For %%I in (%StrOpenFiles%) do echo %%I</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 101:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 102:</span> :: Closing open Lotus Notes Files</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 103:</span> echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 104:</span> Set /P StrConfirmClose="</span>Press &lt;c&gt; to close these files, &lt;enter&gt; key will SKIP <span style="color:#0000ff;">this</span> step.<span style="color:#006080;">"</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 105:</span> IF /I "</span>%StrConfirmClose%<span style="color:#006080;">"=="</span>c<span style="color:#006080;">" (psfile \\%StrHomeServer% %StrNotesPath% -c) ELSE Goto end</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 106:</span> Set Return=return7</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 107:</span> Goto SubEcho</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 108:</span> :return7</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 109:</span> echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 110:</span> echo Open Lotus Notes files closed!</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 111:</span> echo Open Lotus Notes files for user %StrUserName% on server %StrHomeServer% closed. | clip</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 112:</span> Goto End</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 113:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 114:</span> :: Procedure printing the different values determined by script</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 115:</span> :SubEcho</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 116:</span> cls</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 117:</span> Title %StrTitle%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 118:</span> Echo User:        %StrUserName%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 119:</span> Echo Name:        %StrDisplayName%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 120:</span> Echo BaseDN:        %StrBaseDN%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 121:</span> Echo TLD:        %StrTLD%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 122:</span> Echo Root:        %StrRoot%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 123:</span> Echo Domain:        %StrDomain%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 124:</span> Echo HomeDir:    %StrHomeDirectory%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 125:</span> Echo Server:        %StrHomeServer%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 126:</span> Echo Disk:        %StrHardDisk%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 127:</span> Echo Path:        %StrNotesPath%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 128:</span> Goto %Return%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 129:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 130:</span> :Help</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 131:</span> Title %strTitle%</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 132:</span> Echo You should call this script from the command line passing the name of the user to unblock as a parameter. (e.g. "</span>killnotes user1980<span style="color:#006080;">"). The script will then fetch some data, list the open lotus notes files and ask you wheter or not you want to close them.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 133:</span> Echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 134:</span> Echo More specifically, the script will:</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 135:</span> Echo   1. Connect to GC to get domain and display name (ADFind)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 136:</span> Echo   2. Connect to DC to get home directory (ADFind)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 137:</span> Echo   3. Get servername via string manipulation (Set)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 138:</span> Echo   4. Kill PsExec if it's already running (SC)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 139:</span> Echo   5. Find the physical disk (PsExec)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 140:</span> Echo   6. List open Notes files and ask if you whan to close them (PsFile)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 141:</span> Echo   7. Close the files if you confirmed you wanted to do so (PsFile)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 142:</span> Echo   8. Quit</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 143:</span> Echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 144:</span> Echo If you want to apply this script on a number of users then I recommend saving them in a file "</span>userlist.txt" (1 user per line). You can then use a <span style="color:#0000ff;">for</span> loop to launch the script:</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 145:</span> Echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 146:</span> Echo   <span style="color:#0000ff;">for</span> /F %%i <span style="color:#0000ff;">in</span> (userlist.txt) <span style="color:#0000ff;">do</span> killnotes %%i</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 147:</span> Echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 148:</span> Echo IMPORTANT: Physical Disk (%strHardDiskAB%) and Server Name (%strHomeDirAB%) <span style="color:#0000ff;">for</span> AB are HARDCODED. These values need to be adopted <span style="color:#0000ff;">in</span> the script <span style="color:#0000ff;">if</span> the design ever changes.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 149:</span> Echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 150:</span> Echo PS1: The script will print the values of the different variables to allow you to monitor the progress.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 151:</span> Echo PS2: If the script halts <span style="color:#0000ff;">for</span> a moment it's because of number of connections being made <span style="color:#0000ff;">using</span> PsTools.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 152:</span> Echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 153:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 154:</span> ::Deleting variables</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 155:</span> :END</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 156:</span> Echo.</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 157:</span> Echo Quitting...</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;"> 158:</span> Endlocal</pre>
</div>
</div>
<p>There&#8217;s still some room for improvement obviously. The hard coded DFS information, for instance, should be replaced with some decent logic (there are very few users on this infra however, so I didn&#8217;t invest to much time in that part).</p>
<p><a title="Robvanderwoude.com" href="http://www.robvanderwoude.com/">http://www.robvanderwoude.com/</a> proved very helpful while writing this script.</p>
<br />Posted in Scripting Tagged: Batch, LotusNotes <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k0v3.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k0v3.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k0v3.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k0v3.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k0v3.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k0v3.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k0v3.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k0v3.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k0v3.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k0v3.wordpress.com/194/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=194&subd=k0v3&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.koenvermoesen.be/2008/11/03/closing-open-lotus-notes-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f646bcfc3f7534b20fa79e0347353eb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">k0v3</media:title>
		</media:content>
	</item>
		<item>
		<title>Hooking up SQLite and PowerShell</title>
		<link>http://blog.koenvermoesen.be/2008/11/03/hooking-up-sqlite-and-powershell/</link>
		<comments>http://blog.koenvermoesen.be/2008/11/03/hooking-up-sqlite-and-powershell/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 13:36:00 +0000</pubDate>
		<dc:creator>Koen Vermoesen</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://k0v3.wordpress.com/?p=192</guid>
		<description><![CDATA[I&#8217;ve been playing around with SQLite on the command line (cmd that is) a bit. I immediately started wondering if it would be possible to combine this portable SQL engine with PowerShell, but I couldn&#8217;t find any working samples on the internet. After some more research I discovered the SQLite ADO.net 2.0 Provider but I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=192&subd=k0v3&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with <a title="Zero-configuration SQL database engine" href="SQLite" target="_blank">SQLite</a> on the command line (cmd that is) a bit. I immediately started wondering if it would be possible to combine this portable SQL engine with <a title="Windows PowerShell Blog" href="http://blogs.msdn.com/PowerShell/">PowerShell</a>, but I couldn&#8217;t find any working samples on the internet.</p>
<p>After some more research I discovered the <a title="An open source ADO.NET provider for the SQLite database engine" href="http://sqlite.phxsoftware.com/">SQLite ADO.net 2.0 Provider</a> but I couldn&#8217;t get it to work immediately.</p>
<p>It took me a couple of days to find the blog post <a title="Database Queries with Windows Powershell" href="http://blog.jeffreymcmanus.com/762/database-queries-with-windows-powershell/">Database Queries with Windows Powershell</a>. (This blog seems to have moved recently as most of the hyperlinks/search results are still referring to Typepad). The post is nicely commented, so I could rather easily translate the MySQL to SQLite statements with some assistance from the included help file.</p>
<pre><span style="color:#ff6600;">[void][System.Reflection.Assembly]::LoadFrom("D:\DATA\Tools\System.Data.SQLite.dll")

$cn = New-Object -TypeName System.Data.SQLite.SQLiteConnection
$cn.ConnectionString = "Data Source=D:\DATA\Tools\koen.sqlite"
$cn.Open()

$cm = New-Object -TypeName System.Data.SQLite.SQLiteCommand
$sql = "SELECT FirstName, LastName FROM tblKoen"
$cm.Connection = $cn
$cm.CommandText = $sql
$dr = $cm.ExecuteReader()

while ($dr.Read())
{
    write-host $dr.GetString(0) " " $dr.GetString(1)
}

$cn.Close()</span></pre>
<p>Some more interesting links I came across:</p>
<ul>
<li><a title="SQL Tutorial" href="http://www.w3schools.com/sql/default.asp">Learn SQL</a></li>
<li><a title="SQLite ODBC Driver" href="http://www.ch-werner.de/sqliteodbc/">SQLite ODBC driver</a></li>
<li><a title="SQLite Tutorial" href="http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html">SQLite Tutorial</a></li>
</ul>
<br />Posted in Scripting Tagged: PowerShell, SQLite <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k0v3.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k0v3.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k0v3.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k0v3.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k0v3.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k0v3.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k0v3.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k0v3.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k0v3.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k0v3.wordpress.com/192/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=192&subd=k0v3&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.koenvermoesen.be/2008/11/03/hooking-up-sqlite-and-powershell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f646bcfc3f7534b20fa79e0347353eb?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">k0v3</media:title>
		</media:content>
	</item>
		<item>
		<title>VI Toolkit scripting contest winners announced.</title>
		<link>http://blog.koenvermoesen.be/2008/09/06/vi-toolkit-scripting-contest-winners-announced/</link>
		<comments>http://blog.koenvermoesen.be/2008/09/06/vi-toolkit-scripting-contest-winners-announced/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 10:24:18 +0000</pubDate>
		<dc:creator>Stijn Vermoesen</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://k0v3.wordpress.com/2008/09/06/vi-toolkit-scripting-contest-winners-announced/</guid>
		<description><![CDATA[Carter Shanklin announced the winners of the contest. 1st prize: The guest provisioning system of LucD. This application lets you provision your VMs in an easy way. You can set the options from one screen no clicking around to configure everything manually. 2nd prize: VI Power Documenter by tzamora. This script generates reports about your [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=164&subd=k0v3&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Carter Shanklin <a href="http://blogs.vmware.com/vipowershell/2008/09/announcing-the.html" target="_blank">announced</a> the winners of the contest.</p>
<p><strong>1st prize</strong>: <a href="http://communities.vmware.com/docs/DOC-7472" target="_blank">The guest provisioning system</a> of <em>LucD</em>. This application lets you provision your VMs in an easy way. You can set the options from one screen no clicking around to configure everything manually.</p>
<p><strong>2nd prize:</strong> <a href="http://communities.vmware.com/docs/DOC-7473" target="_blank">VI Power Documenter</a> by <em>tzamora.</em> This script generates reports about your virtual infrastructure.</p>
<p><strong>3rd prize:</strong> <a href="http://communities.vmware.com/docs/DOC-6930" target="_blank">PowerVDI script</a> by <em><a href="http://virtualgeek.typepad.com/virtual_geek/2008/08/powershell-scri.html" target="_blank">Dan Baskette</a></em>. It let you deploy multiple VDI instances on an EMC celera using snapshots and AD integration.</p>
<p>I&#8217;m sure there are other <a href="http://communities.vmware.com/community/developer/toolkit_contest?view=documents&amp;numResults=15" target="_blank">contributions</a> that are very useful.</p>
<p>Congrats to the winners. Nice job guys.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/k0v3.wordpress.com/164/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/k0v3.wordpress.com/164/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k0v3.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k0v3.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k0v3.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k0v3.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k0v3.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k0v3.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k0v3.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k0v3.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k0v3.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k0v3.wordpress.com/164/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=164&subd=k0v3&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.koenvermoesen.be/2008/09/06/vi-toolkit-scripting-contest-winners-announced/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62aee00de3e0280aadbe38323469a9be?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">sak1n1</media:title>
		</media:content>
	</item>
		<item>
		<title>PowerGui integrates with VI Client</title>
		<link>http://blog.koenvermoesen.be/2008/07/31/powergui-integrates-with-vi-client/</link>
		<comments>http://blog.koenvermoesen.be/2008/07/31/powergui-integrates-with-vi-client/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 09:36:54 +0000</pubDate>
		<dc:creator>Stijn Vermoesen</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[PowerGUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://k0v3.wordpress.com/?p=113</guid>
		<description><![CDATA[Dmitri over at Dmitry’s PowerBlog just posted about the integration between PowerGui and the VI client. I had already installed the PowerGUI 1.5.1 version but hadn&#8217;t noticed the plugin for the VI Client. This makes managing your VMware environment using  Powershell even more easier. PowerGUI lets you write your own Powershell scripts and the VMware [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=113&subd=k0v3&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Dmitri over at <a href="http://dmitrysotnikov.wordpress.com/">Dmitry’s PowerBlog</a> just posted about the integration between <a href="http://dmitrysotnikov.wordpress.com/2008/07/31/powergui-plugin-inside-vmware-infrastructure-client/" target="_blank">PowerGui and the VI client</a>. I had already installed the PowerGUI 1.5.1 version but hadn&#8217;t noticed the plugin for the VI Client.</p>
<p>This makes managing your VMware environment using  Powershell even more easier. PowerGUI lets you write your own Powershell scripts and the <a href="http://powergui.org/entry!default.jspa?categoryID=21&amp;externalID=1802" target="_blank">VMware PowerPack</a> is also compatible with the VI client plugin. The plugin uses your current connection to the VC. You don&#8217;t need to make a separate connection for every script.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/k0v3.wordpress.com/113/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/k0v3.wordpress.com/113/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/k0v3.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/k0v3.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/k0v3.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/k0v3.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/k0v3.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/k0v3.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/k0v3.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/k0v3.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/k0v3.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/k0v3.wordpress.com/113/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.koenvermoesen.be&blog=3561314&post=113&subd=k0v3&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.koenvermoesen.be/2008/07/31/powergui-integrates-with-vi-client/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/62aee00de3e0280aadbe38323469a9be?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">sak1n1</media:title>
		</media:content>
	</item>
	</channel>
</rss>