<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://dverweij.spaces.live.com/mmm2008-07-24_12.50/rsspretty.aspx?rssquery=en-US;http%3a%2f%2fdverweij.spaces.live.com%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Just Powershell it</title><description>That's just the thing an administrator should do. Don't repeate, automate!</description><link>http://dverweij.spaces.live.com/</link><language>en-US</language><pubDate>Sat, 12 Jul 2008 01:36:10 GMT</pubDate><lastBuildDate>Sat, 12 Jul 2008 01:36:10 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><live:identity><live:id>-6645245869990399496</live:id><live:alias>dverweij</live:alias></live:identity><image><title>Just Powershell it</title><url>http://tkfiles.storage.live.com/y1pe3qweQbu6zEIb1Vw6M_H2EK2Pn-RWwWJWKJjBhDU7GhxL6dmSooung</url><link>http://dverweij.spaces.live.com/</link></image><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>VMware COM API</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!155.entry</link><description>&lt;div&gt;It has been a while since I last posted a new entry, but time has yet again not been my best friend.&lt;/div&gt;
&lt;div&gt;The last months I've been busy with virtualizations and VMware VI3 in particulair. I wouldn't be me if I wouldn't try leveraging the power of Powershell with VMware. I'm still working on ways to use the VMware SDK with powershell and that means a whole challenge of  really understanding C# and the VMware SDK to write cmdlets. Still nothing to post on this, but there are ways to use powershell to manage VMware infrastructures. This is done throught the VMware COM API. &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;As shown with earlier postings about Citrix it is easy to use COM objects in Powershell. This is the same for VMware.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;I will not post an indepth description of how to do all the possible tasks, but it should be enough to get you going. The VMware scripting API is less powerfull than the SDK. Tasks like for instance migrating a VM or creating a VM are not possible through the SDK, but tasks like power operations, taking snapshot, deleting snapshots and so on &lt;u&gt;are&lt;/u&gt; possible and that makes it exciting!&lt;/div&gt;
&lt;div&gt;Before starting working with the API, first download and install the API at: &lt;a href="http://www.vmware.com/download/sdk/api.html"&gt;http://www.vmware.com/download/sdk/api.html&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;For detailed information about the API download the manual from VMware at: &lt;font face=Arial size=2&gt; &lt;/font&gt;&lt;a href="http://www.vmware.com/pdf/Scripting_API_23.pdf"&gt;&lt;font face=Arial color=blue size=2&gt;&lt;u&gt;http://www.vmware.com/pdf/Scripting_API_23.pdf&lt;/u&gt;&lt;/font&gt;&lt;/a&gt; &lt;/div&gt;
&lt;div&gt;There are some perl and vbscript samples in the document and this can easily be translated in powershell.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Oke, now let's just connect to a VI3 host. Just type the following in the commandline.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $cp=new-object -com vmcom.vmconnectparams&lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $cp.hostname= &amp;quot;ESXhostname&amp;quot;&lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $cp.username= &amp;quot;root&amp;quot;  #use a username with enough permissions on the ESX host.&lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $cp.password= &amp;quot;password&amp;quot;&lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $srv=new-object -com vmcom.vmserverctl&lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $srv.connect($cp)&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;now you are connected to the host. If you type $srv you'll get the vm's registered on the host. A better readable list is created by using:&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $srv.RegisteredVmNames&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;You'll see that the listing actually shows the .vmx files on the host.&lt;/div&gt;
&lt;div&gt;Of cource you can get the members of the object by using get-member&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $srv|gm&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;To connect to a particulair VM do the following&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;option 1:&lt;/div&gt;
&lt;div&gt;copy the complete name of a vmx file path from the previous listing and put it in a variable, lets say $vmname&lt;/div&gt;
&lt;div&gt;Now type the following:&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $vm=new-object -com vmcom.vmctl &lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $vm.connect($cp,$vmname)&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;If we than look at the members by using get-member we see what we can do with it.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Let say we want to see if the virtual machine has snapshots. You do the following:&lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $vm.HasSnapshot&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;If there is a snapshot, 1 is returned. Otherwise 0 is returned.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Option 2:&lt;/div&gt;
&lt;div&gt;If you know the servername of the virtual machine (say server15) and you want to query it directly you can do the following:&lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $srv.RegisteredVmNames|where {$_ -like &amp;quot;*server15*&amp;quot;}|$vm.connect($cp,$_)&lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $vm.HasSnapshot&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Of cource you must allready have created the $vm object as shown above. Same is for the example below.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Option 3:&lt;/div&gt;
&lt;div&gt;If we want to know which VM's have snapshots we can do the following:&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;ps/&amp;gt; $srv.RegisteredVmNames| foreach {&lt;/div&gt;
&lt;div&gt;&amp;gt;&amp;gt; $vm.connect($cp,$_)&lt;/div&gt;
&lt;div&gt;&amp;gt;&amp;gt; if ($vm.HasSnapshot -gt 0)&lt;/div&gt;
&lt;div&gt;&amp;gt;&amp;gt; {&lt;/div&gt;
&lt;div&gt;&amp;gt;&amp;gt; $_&lt;/div&gt;
&lt;div&gt;&amp;gt;&amp;gt; }&lt;/div&gt;
&lt;div&gt;&amp;gt;&amp;gt; }&lt;/div&gt;
&lt;div&gt;ps/&amp;gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;As said before, this is not a complete description of the VMware API, but just a brief introduction. This should get you on the go and create some nice scripts to make you're life at least a little easier. &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Oke, this is it for now, but I promise updates will follow soon.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Greetings&lt;/div&gt;
&lt;div&gt;Dennis Verweij&lt;/div&gt;
&lt;div&gt;&lt;a href="http://dverweij.spaces.live.com/"&gt;http://dverweij.spaces.live.com&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+VMware+COM+API&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><category>VMware</category><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!155.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!155.entry</guid><pubDate>Thu, 16 Aug 2007 13:01:00 GMT</pubDate><slash:comments>3</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!155/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!155.entry#comment</wfw:comment><dcterms:modified>2007-08-16T13:01:57Z</dcterms:modified></item><item><title>searching msdn within powershell</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!144.entry</link><description>&lt;div&gt; &lt;/div&gt;
&lt;div&gt;What if you're in Powershell and need to know how to use a specific namespace or class? Of course you can start internet explorer, go to msdn and do a search. &lt;/div&gt;
&lt;div&gt;But why not do this from within powershell? &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;&lt;/em&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;Function msdn {&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;param([string]$searchstring=&amp;quot;&amp;quot;)&lt;br&gt;$inet = New-Object -Com Internetexplorer.Application&lt;br&gt;$netsearch = &amp;quot;&lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/forms?queryTerm"&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;http://msdn2.microsoft.com/en-us/forms?queryTerm&lt;/font&gt;&lt;/a&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;=&amp;quot;&lt;br&gt;$inet.Navigate($netsearch+$searchstring)&lt;br&gt;$inet.Visible=$TRUE&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;And now, we can just type:&lt;/div&gt;
&lt;div&gt;PS:&amp;gt; msdn forms&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;The result will be a new internet explorer window with you're search results.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;You can put this function in you're profile so you can use it all the time.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;have fun&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Grt&lt;/div&gt;
&lt;div&gt;Dennis&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+searching+msdn+within+powershell&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><category>handy script</category><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!144.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!144.entry</guid><pubDate>Wed, 17 Jan 2007 19:47:03 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!144/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!144.entry#comment</wfw:comment><dcterms:modified>2007-01-18T10:13:34Z</dcterms:modified></item><item><title>A complete directory listing</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!137.entry</link><description>&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Sometimes there are things I just want to try the hard way. Of course you can get a complete directory listing by using &lt;/div&gt;
&lt;div&gt;get-childitem -recurse, but you can also do it differently. Same output, but much more fun to try and héy, you want to learn powershell or you don't. I do. &lt;/div&gt;
&lt;div&gt;So the stuff below might seem useless effort, but you can use it for much more than just a directorylisting.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;It's easy to get a directory listing one level down, or two, or three, or whatever. Just as long as you know how many subs there are. So what if you don't know how many levels down a directorystructure goes or if you just don't care. Then you can do the following:&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" face=Arial color="#ffffff" size=2&gt;PS&amp;gt;&amp;gt;Function dirlist {ls $_.FullName|Foreach {$_;if ($_.Mode -like &amp;quot;d*&amp;quot;){dirlist}}};Get-Item * |Foreach {$_;if&lt;br&gt; ($_.Mode -like &amp;quot;d*&amp;quot;){dirlist}}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;If you do the above you'll get the info, but in an pretty unreadable format, so just format the output:&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;
&lt;div&gt;&lt;font size=2&gt;&lt;font style="background-color:#333399" face=Arial color="#ffffff"&gt;PS&amp;gt;&amp;gt;Function dirlist {ls $_.FullName|Foreach {$_;if ($_.Mode -like &amp;quot;d*&amp;quot;){dirlist}}};Get-Item * |Foreach {$_;if&lt;br&gt; ($_.Mode -like &amp;quot;d*&amp;quot;){dirlist}} |ft name,fullname&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;And you can sort on what and how you want&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;
&lt;div&gt;&lt;font size=2&gt;&lt;font style="background-color:#333399" face=Arial color="#ffffff"&gt;PS&amp;gt;&amp;gt;Function dirlist {ls $_.FullName|Foreach {$_;if ($_.Mode -like &amp;quot;d*&amp;quot;){dirlist}}};Get-Item * |Foreach {$_;if&lt;br&gt; ($_.Mode -like &amp;quot;d*&amp;quot;){dirlist}} |Sort-Object -descending creationtime|ft name,creationtime&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;Or just export to a csv so that later, you can do whatever you want. Sort it, filter, choose output format, etc, etc.&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;font size=2&gt;&lt;font style="background-color:#333399" face=Arial color="#ffffff"&gt;PS&amp;gt;&amp;gt;Function dirlist {ls $_.FullName|Foreach {$_;if ($_.Mode -like &amp;quot;d*&amp;quot;){dirlist}}};Get-Item * |Foreach {$_;if&lt;br&gt; ($_.Mode -like &amp;quot;d*&amp;quot;){dirlist} | Export-csv dirlist.csv&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;**update**&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;As Vinicius Canto mentioned in the reactions, there is a better way to determine if a childitem is a container (directory) or not. This is done by checking the NoteProperty &amp;quot;$_.PSIsContainer&amp;quot;, instead of what I used: &amp;quot;if ($_.Mode -like &amp;quot;d*&amp;quot;)&amp;quot; or using the -band operator as Vinicius used on his blog at &lt;a href="http://viniciuscanto.blogspot.com/2007/01/dir-ad-no-powershell-onde-ele-foi-parar.html"&gt;http://viniciuscanto.blogspot.com/2007/01/dir-ad-no-powershell-onde-ele-foi-parar.html&lt;/a&gt;&amp;quot;&lt;/div&gt;
&lt;div&gt;The NoteProperty &amp;quot;PSIsContainer&amp;quot; works faster than doing a compaire. It simply results in a $True of $False&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;This results in:&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;font size=2&gt;&lt;font style="background-color:#333399" face=Arial color="#ffffff"&gt;PS&amp;gt;&amp;gt;Function dirlist {ls $_.FullName|Foreach {$_;if ($_.PSIsContainer){dirlist}}};Get-Item * |Foreach {$_;if&lt;br&gt; ($_.PSIsContainer){dirlist} | Export-csv dirlist.csv&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Thanks Vinicius. And Jeffrey Snover who gave the initial hint.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;Grt&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face=Arial size=2&gt;Dennis&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size=2&gt;&lt;font style="background-color:#333399" face=Arial color="#ffffff"&gt;&lt;/font&gt;&lt;/font&gt; &lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+A+complete+directory+listing&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><category>one-liners</category><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!137.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!137.entry</guid><pubDate>Tue, 09 Jan 2007 09:14:52 GMT</pubDate><slash:comments>4</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!137/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!137.entry#comment</wfw:comment><dcterms:modified>2007-01-15T07:32:22Z</dcterms:modified></item><item><title>Changing the incorrect homedir path of all users</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!129.entry</link><description>&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;This powershell script is to correct the users homedrive path in Active Directory. &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;The following steps are done by the script:&lt;/div&gt;
&lt;div&gt;- First it looks up the users with an incorrect homedrive annotation&lt;/div&gt;
&lt;div&gt;- For those users it changes the, in this case, servername to an alias&lt;/div&gt;
&lt;div&gt;- save the info an continue with the next one.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# Powershell script&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# Citrix Export published applications&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# D. Verweij&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;#&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;###&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;# Connect to the AD&lt;/font&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;$root = [adsi]'LDAP://OU=users,OU=application,OU=services,DC=face,DC=foo,DC=nl'&lt;br&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# Configure the searcher&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;$searcher = new-object directoryservices.directorysearcher&lt;br&gt;$searcher.searchroot = $root&lt;br&gt;$searcher.filter = &amp;quot;(objectclass=user)&amp;quot;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;&lt;em&gt;&lt;font color="#c0c0c0"&gt;# Loop up accounts with an incorrect homedrive&lt;/font&gt;&lt;/em&gt;&lt;br&gt;$searcher.findall()|where {$_.properties.item(&amp;quot;homedirectory&amp;quot;) -like &amp;quot;*servername*&amp;quot;}|foreach {&lt;br&gt;   $userrt=&amp;quot;&lt;/font&gt;&lt;a&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;LDAP://&amp;quot;+$_.properties.item(&amp;quot;distinguishedName&lt;/font&gt;&lt;/a&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;&amp;quot;)&lt;br&gt;   $userads = [adsi]$userrt&lt;br&gt;   $userhome=$userads.homedirectory&lt;br&gt;   $userads.put(&amp;quot;homedirectory&amp;quot;,$userhome.psbase.value.replace(&amp;quot;servername&amp;quot;,&amp;quot;serveralias&amp;quot;))&lt;br&gt;   $userads.setinfo()&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Grt&lt;/div&gt;
&lt;div&gt;Dennis&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+Changing+the+incorrect+homedir+path+of+all+users&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><category>Active Directory</category><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!129.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!129.entry</guid><pubDate>Fri, 29 Dec 2006 08:02:17 GMT</pubDate><slash:comments>2</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!129/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!129.entry#comment</wfw:comment><dcterms:modified>2006-12-29T08:02:26Z</dcterms:modified></item><item><title>Import Citrix published applications</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!128.entry</link><description>&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;After exporting the published application setting in an earlier post, here is the script I used to import the applications in the new farm.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# Powershell script&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# Citrix Export published applications&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# D. Verweij&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;#&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;###&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;# First the known steps to connect to the mfcom and initialize the object&lt;/font&gt;&lt;/em&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" face="Verdana, Geneva, Arial, Sans-serif" color="#ffffff"&gt;$c_farm = new-object -com metaframecom.metaframefarm&lt;br&gt;$c_farm.initialize(1)&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;# Then we import the csv file and for each we do..&lt;/font&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" face="Verdana, Geneva, Arial, Sans-serif" color="#ffffff"&gt;import-csv c:\citrix\Citrix_apps.csv | foreach{&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" face="Verdana, Geneva, Arial, Sans-serif" color="#ffffff"&gt; $c_app=$c_farm.addapplication($_.apptype)&lt;br&gt; $w_app = $c_app.winappobject&lt;br&gt; $c_app.Appname = $_.appname&lt;br&gt; $c_app.description = $_.description&lt;br&gt; $w_app.defaultencryption = $_.defaultencryption&lt;br&gt; $w_app.defaultinitprog = $_.defaultinitprog&lt;br&gt; $w_app.defaultworkdir = $_.defaultworkdir&lt;br&gt; $w_app.browsername = $_.browsername&lt;br&gt; $w_app.enableapp = $_.enableapp&lt;br&gt; $w_app.hidefrompnenum = $_.hidefrompnenum&lt;br&gt; $w_app.hidefrombrowserenum = $_.hidefrombrowserenum&lt;br&gt; $w_app.defaultwindowcolor = $_.defaultwindowcolor&lt;br&gt; $w_app.defaultwindowtype = $_.defaultwindowtype&lt;br&gt; $w_app.defaultsoundtype = $_.defaultsoundtype&lt;br&gt; $w_app.desktopintegrate = $_.desktopintegrate&lt;br&gt; $w_app.mfattributes = $_.mfattributes&lt;br&gt; $w_app.publishingflags = $_.publishingflags&lt;br&gt; $w_app.PNAttributes = $_.PNAttributes&lt;br&gt; $w_app.AllowMultiInstancePerUser = $_.AllowMultiInstancePerUser&lt;br&gt; $w_app.StartMenuFolder = $_.StartMenuFolder&lt;br&gt; $w_app.PlaceUnderProgramsFolder = $_.PlaceUnderProgramsFolder&lt;br&gt; $w_app.WaitOnPrinterCreation = $_.WaitOnPrinterCreation&lt;br&gt; $w_app.defaultwindowwidth = $_.defaultwindowwidth&lt;br&gt; $w_app.defaultwindowheight = $_.defaultwindowheight&lt;br&gt; $w_app.defaultwindowscale = $_.defaultwindowscale&lt;br&gt; $w_app.parentfolderDN = $_.parentfolderDN&lt;br&gt; $w_app.pnfolder = $_.pnfolder&lt;br&gt; $c_app.savedata()&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Of course there are much more settings to specify and the above are just the one I needed. To see the complete list, just use the &amp;quot;get-member&amp;quot; :&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399"&gt;$farm = new-object -com metaframecom.metaframefarm&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399"&gt;$farm.initialize(1)&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399"&gt;$farm.applications|get-member&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;note! for some additional settings you need the winappobject properties (some properties in the script above are winappobject properties). The members of winappobject are shown the same way, but you will first have to choose an application:&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;For instance:&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399"&gt;$sampleapp = $farm.applications|where {$_.appname -like &amp;quot;sampleapp&amp;quot;}   # appname is the displayname of the published app&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399"&gt;$sampleapp.winappobject|get-member&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;**update**&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;If you haven't already, you should take a look at the post on &lt;a href="http://blogs.msdn.co/powershell"&gt;http://blogs.msdn.co/powershell&lt;/a&gt; where Jeffrey Snover did some tuning on my script. I haven't had the time to test it yet, but I will and you should too. It's great.&lt;/div&gt;
&lt;div&gt;The post can be found here:&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blogs.msdn.com/powershell/archive/2006/12/29/use-copy-property-to-make-it-easier-to-write-read-and-review-scripts.aspx" rel=nofollow&gt;&lt;font color="#0066cc"&gt;http://blogs.msdn.com/powershell/archive/2006/12/29/use-copy-property-to-make-it-easier-to-write-read-and-review-scripts.aspx&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Have fun!&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Grt&lt;/div&gt;
&lt;div&gt;Dennis&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+Import+Citrix+published+applications&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><category>Citrix</category><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!128.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!128.entry</guid><pubDate>Fri, 29 Dec 2006 07:33:23 GMT</pubDate><slash:comments>3</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!128/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!128.entry#comment</wfw:comment><dcterms:modified>2007-01-15T07:40:49Z</dcterms:modified></item><item><title>Technorati</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!127.entry</link><description>&lt;a href="http://www.technorati.com/claim/j3fmnkmc6r" rel=me&gt;Technorati Profile&lt;/a&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+Technorati&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!127.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!127.entry</guid><pubDate>Fri, 29 Dec 2006 06:32:57 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!127/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!127.entry#comment</wfw:comment><dcterms:modified>2006-12-29T06:35:51Z</dcterms:modified></item><item><title>Export Citrix published applications</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!126.entry</link><description>&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;During a migration of our Citrix farm to Presentation Server 4.0, I needed to export the published applications from the old Metaframe farm.&lt;/div&gt;
&lt;div&gt;I wanted the export to be a csv file with all the properties to recreate the applications in the new farm.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;So, for this I made the following script.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# Powershell script&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# Citrix Export published applications&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# D. Verweij&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;#&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;###&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;# First the known steps to connect to the mfcom and initialize the object&lt;/font&gt;&lt;/em&gt; &lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;$c_farm = new-object –com metaframecom.metaframefarm&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;$c_farm.initialize(1) &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# Now we read the properties of the published applications&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;$c_farm.applications|select-object &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.appname};n='appname'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.groups|foreach {$_.groupname}};n='groupname'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.users|foreach{$_.username}};n='username'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.distinguishedname};n='distinguishedname'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.description};n='description'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.apptype};n='apptype'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.browsername};n='browsername'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.enableapp};n='enableapp'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.hidefrompnenum};n='hidefrompnenum'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.hidefrombrowserenum};n='hidefrombrowserenum'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.defaultencryption};n='defaultencryption'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.defaultinitprog};n='defaultinitprog'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.defaultworkdir};n='defaultworkdir'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.defaultwindowwidth};n='defaultwindowwidth'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.defaultwindowheight};n='defaultwindowheight'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.defaultwindowcolor};n='defaultwindowcolor'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.defaultwindowtype};n='defaultwindowtype'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.defaultsoundtype};n='defaultsoundtype'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.defaultwindowscale};n='defaultwindowscale'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.desktopintegrate};n='desktopintegrate'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.mfattributes};n='mfattributes'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.publishingflags};n='publishingflags'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.PNAttributes};n='PNAttributes'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.PNFolder};n='PNFolder'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.parentfolderDN};n='parentfolderDN'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.AllowMultiInstancePerUser};n='AllowMultiInstancePerUser'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.StartMenuFolder};n='StartMenuFolder'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.PlaceUnderProgramsFolder};n='PlaceUnderProgramsFolder'},&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;@{e={$_.winappobject.WaitOnPrinterCreation};n='WaitOnPrinterCreation'}|&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# The last step is to pipe this to the export-csv cmdlet&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;export-csv c:\citrix\Citrix_apps.csv &lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Later on I'll go on with importing these apps. &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Grt&lt;/div&gt;
&lt;div&gt;Dennis&lt;/div&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+Export+Citrix+published+applications&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><category>Citrix</category><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!126.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!126.entry</guid><pubDate>Thu, 28 Dec 2006 14:26:05 GMT</pubDate><slash:comments>1</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!126/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!126.entry#comment</wfw:comment><dcterms:modified>2006-12-28T14:26:05Z</dcterms:modified></item><item><title>Move computer objects in Active Directory</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!115.entry</link><description>&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;For our test enviroment we use a seperate OU in Active Directory to test WSUS updates and patches. Servers are put in this OU when patches have to be tested on curtain servers. To automate this, I of course, created a powershell script to do just this. &lt;/div&gt;
&lt;div&gt;The following had to be realized:&lt;/div&gt;
&lt;div&gt;- Create a script that moves the server to the test OU&lt;/div&gt;
&lt;div&gt;- The script had to be launched as an Altiris job with the abbility to run it on several server at the same time&lt;/div&gt;
&lt;div&gt;- For every server the original OU must be remembered to, with the next job, move it back&lt;/div&gt;
&lt;div&gt;- Another job (script) has to put the computer in the original OU after the updates are finished&lt;/div&gt;
&lt;div&gt;- One problem..the Altiris server runs in a different domain and there's no trust between the two domains&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;So I had to move the server to the test OU and had to remember the original OU to move it back and this for an unlimited number of servers at the same time.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Since the job must run from Altiris, dragged to a server, servergroup or scheduled on several servers, the server name must be given as a parameter. &lt;/div&gt;
&lt;div&gt;The Altiris job does the following things:&lt;/div&gt;
&lt;div&gt;- copy the script to the specified server in the %systemroot%\Temp directory&lt;/div&gt;
&lt;div&gt;- start the script as in a scheduled task : &lt;/div&gt;
&lt;div&gt;         %systemroot%\system32\WindowsPowershell\v1.0\powershell.exe %systemroot%\Temp\scriptname %computername%&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;The following script is to move the server.&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;&lt;/em&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# Powershell script&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# WSUS Moving computer object to the Test OU&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# D. Verweij&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;#&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;###&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# First read the given parameter in the variable $servnm&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;param([string]$servnm=&amp;quot;none&amp;quot;)&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;&lt;em&gt;&lt;font color="#c0c0c0"&gt;# Specify the name of the logfile to save the original OU in. This file is saved on the machine you move and run the script&lt;br&gt;&lt;/font&gt;&lt;/em&gt;$ServFL = &amp;quot;C:\Altiris\logfiles\$servnm&amp;quot;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;&lt;font color="#c0c0c0"&gt;&lt;em&gt;# Specify the target OU&lt;br&gt;&lt;/em&gt;&lt;/font&gt;$patchOU=&amp;quot;&lt;/font&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;LDAP://OU=WSUSTest,OU=Services,DC=Dennis,DC=Verweij,DC=nl&amp;quot;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;&lt;em&gt;&lt;font color="#c0c0c0"&gt;# Connect to the root of the domain&lt;br&gt;&lt;/font&gt;&lt;/em&gt;$ad1=[adsi]''&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;&lt;em&gt;&lt;font color="#c0c0c0"&gt;# Setup the search criteria&lt;br&gt;&lt;/font&gt;&lt;/em&gt;$ad1search = new-object directoryservices.directorysearcher&lt;br&gt;$ad1search.searchroot = $ad1&lt;br&gt;$ad1search.filter=&amp;quot;(objectclass=computer)&amp;quot;&lt;br&gt;$serv2=$ad1search.findall()|where {$_.properties.item(&amp;quot;cn&amp;quot;) -like $servnm}&lt;br&gt;&lt;em&gt;&lt;font color="#c0c0c0"&gt;# Save the distinguishedname of the original OU in the logfile. You need the distinguished name to move it back &lt;/font&gt;&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;$serv2.properties.item(&amp;quot;distinguishedname&amp;quot;) &amp;gt; $ServFL&lt;br&gt;$servDN=$serv2.properties.item(&amp;quot;distinguishedname&amp;quot;)&lt;br&gt;&lt;em&gt;&lt;font color="#c0c0c0"&gt;# Connect to the computerobject&lt;/font&gt;&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;$serv=[adsi]&amp;quot;&lt;/font&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;LDAP://$servDN&amp;quot;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;&lt;em&gt;&lt;font color="#c0c0c0"&gt;# And move it&lt;br&gt;&lt;/font&gt;&lt;/em&gt;$serv.psbase.MoveTo($patchOU)&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;To move it back the Altiris job is pretty much the same except for the script name&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;The script to put it back:&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# Powershell script&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# WSUS Moving computer object to the original OU&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# D. Verweij&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;#&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;###&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# First read the given parameter in the variable $servnm&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399"&gt;param([string]$servnm=&amp;quot;none&amp;quot;)&lt;br&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font color="#ffffff"&gt;&lt;font style="background-color:#333399"&gt;&lt;font color="#c0c0c0"&gt;&lt;em&gt;# Specify the Test OU&lt;br&gt;&lt;/em&gt;&lt;/font&gt;$patchOU=&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;LDAP://OU=WSUSTest,OU=Services,DC=Dennis,DC=Verweij,DC=nl&amp;quot;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font color="#ffffff"&gt;&lt;font style="background-color:#333399"&gt;&lt;em&gt;&lt;font color="#c0c0c0"&gt;# Specify the name of the logfile the original OU is saved in&lt;br&gt;&lt;/font&gt;&lt;/em&gt;$ServFL = &amp;quot;C:\Altiris\logfiles\$servnm&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;&lt;em&gt;# Check if the logfile exists&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399"&gt;if(test-path $ServFL)&lt;br&gt;{&lt;br&gt;  &lt;em&gt;&lt;font color="#c0c0c0"&gt;# Read the logfile and get rid of the computername&lt;/font&gt;&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399"&gt;  gc $ServFL|%{$servDN = $_.ToUpper().replace(&amp;quot;CN=$servnm,&amp;quot;,&amp;quot;&amp;quot;)}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399"&gt;  &lt;em&gt;&lt;font color="#c0c0c0"&gt;# Connect to the computerobject&lt;/font&gt;&lt;/em&gt;&lt;br&gt;  $serv = [adsi]&amp;quot;&lt;/font&gt;&lt;font style="background-color:#333399"&gt;LDAP://CN=$servnm,$patchOU&amp;quot;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399"&gt;  &lt;em&gt;&lt;font color="#c0c0c0"&gt;# And move it back were it came from&lt;/font&gt;&lt;/em&gt;&lt;br&gt;  $serv.psbase.MoveTo(&amp;quot;&lt;/font&gt;&lt;font style="background-color:#333399"&gt;LDAP://$servDN&amp;quot;&lt;/font&gt;&lt;font style="background-color:#333399"&gt;)&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399"&gt;&lt;em&gt;&lt;font color="#c0c0c0"&gt;# Finally delete the logfile&lt;/font&gt;&lt;/em&gt;&lt;br&gt;del $ServFL&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Hope you can do something with it!&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Grt&lt;/div&gt;
&lt;div&gt;Dennis&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+Move+computer+objects+in+Active+Directory&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><category>Active Directory</category><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!115.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!115.entry</guid><pubDate>Thu, 28 Dec 2006 10:40:07 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!115/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!115.entry#comment</wfw:comment><dcterms:modified>2006-12-28T13:38:28Z</dcterms:modified></item><item><title>deleting files created 48 hours ago</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!114.entry</link><description>&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;In adition to an earlier post, there was another thing I had to do with created reports by users.&lt;/div&gt;
&lt;div&gt;Namely: Deleting reports created more than 48 hours ago.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;In a curtain application users were able to create reports and save them temporaraly in there homedir for further use. To avoid there report directories from growing to big I made a powershell script wich we scheduled to run every 24 hours that removes reports with a creationtime of more than 48 hours ago. This would result in reports beeing available for at least 48 hours with a maximum age of 71 hours and 59 seconds.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;# Powershell script&lt;/font&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" face="Verdana, Geneva, Arial, Sans-serif" color="#c0c0c0"&gt;&lt;em&gt;# Deleting reports with creationtime more than 48 hours ago&lt;/em&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;# D. Verweij&lt;/font&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;font style="background-color:#333399" color="#c0c0c0"&gt;#&lt;/font&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" face="Verdana, Geneva, Arial, Sans-serif" color="#ffffff"&gt;ls \\fileserver\homedir$\app | foreach{&lt;br&gt;if (test-path \\fileserver\homedir$\app\$_\reports ){&lt;br&gt;$user = $_&lt;br&gt;$RepDir = $_.getdirectories()|where-object {$_ -like &amp;quot;*reports*&amp;quot;}&lt;br&gt;$RepDir.getfiles()|foreach{&lt;br&gt;$contrtime = get-date&lt;br&gt;$timediff = $contrtime - $_.lastwritetime&lt;br&gt;if ($timediff.totalhours -gt 48){&lt;br&gt;$name = \\fileserver\homedir$\app\$user\reports\ + $_.name&lt;br&gt;del $name}&lt;br&gt;}}}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Grt&lt;/div&gt;
&lt;div&gt;Dennis&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+deleting+files+created+48+hours+ago&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!114.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!114.entry</guid><pubDate>Thu, 28 Dec 2006 09:15:06 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!114/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!114.entry#comment</wfw:comment><dcterms:modified>2006-12-28T09:15:06Z</dcterms:modified></item><item><title>Windows PowerShell: TFM™ ... Yes! it's out.</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!113.entry</link><description>&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;I've been eagerly waiting for this book from sapien and can't wait to get my hands on it. &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;some samples of the book can be found here:&lt;/div&gt;
&lt;div&gt;&lt;a href="http://www.sapienpress.com/powershell.asp"&gt;http://www.sapienpress.com/powershell.asp&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;happy reading and learning&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Grt&lt;/div&gt;
&lt;div&gt;Dennis&lt;/div&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+Windows+PowerShell%3a+TFM%e2%84%a2+...+Yes!+it's+out.&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><category>Boeken</category><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!113.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!113.entry</guid><pubDate>Thu, 28 Dec 2006 07:14:44 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!113/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!113.entry#comment</wfw:comment><dcterms:modified>2006-12-28T13:38:50Z</dcterms:modified></item><item><title>the beauty of simple things: listing directory content</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!112.entry</link><description>&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;So, why not posting the simple things in this blog.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Once I had to list the content of a directory in the homedir of all 2500+ users. Not all users had this directory and I didn't know who did or didn't. Of course I could have done a search with explorer, but why not do it with powershell. It would only take one simple line and then I would have all the information I needed and in the end I could do with it whatever I wanted. You can format the outcome, export it to a txt, csv of whatever you want. Not that I wanted to, if just needed the info, but......I could have....&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;By using &amp;quot;test-path&amp;quot; I would't get any errors if directories don't exist or if there files in de search root.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;#--&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" face="Verdana, Geneva, Arial, Sans-serif" color="#ffffff"&gt;ls|% {if (test-path ./$_/reports){ls ./$_/reports}}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;font face="Courier New, Courier, Monospace" color="#ffffff"&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;#--&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;So, oke, you actually want to do something with this info. For instance, you want a nice formatted csv file with two columns &amp;quot;homedir&amp;quot; (=username) and &amp;quot;report&amp;quot;. Do the following.&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;#--&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;font style="background-color:#333399" face="Verdana, Geneva, Arial, Sans-serif" color="#ffffff"&gt;ls|% {if (test-path ./$_/rapporten){$dirname=$_.name;ls ./$dirname/reports}}|select @{e={$dirname};n=&amp;quot;homedir&amp;quot;},@{e={$_.name};n=&amp;quot;report&amp;quot;}|export-csv $env:systemroot\temp\reports.csv&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;font face="Courier New, Courier, Monospace" color="#999999"&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;#--&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;This may look like a lot of typing, but believe me, after a while, you'll type it in the command line as if it is you're native language. Just type what you're thinking and it will all fall in place :&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;I want a directorylisting = &lt;font color="#ff0000"&gt;ls&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;With the output I want to .. = &lt;font color="#ff0000"&gt;|&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;For every childitem it want.. = &lt;font color="#ff0000"&gt;% {&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;If the directory exists If want to do the following = &lt;font color="#ff0000"&gt;if (test-path ......){&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;remember the directory you search = &lt;font color="#ff0000"&gt;$dirname=$_.name&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;and list the content of the report directory in this directory = &lt;font color="#ff0000"&gt;ls ./$dirname/reports&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;End the &amp;quot;if&amp;quot; = &lt;font color="#ff0000"&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;End the &amp;quot;foreach&amp;quot;= &lt;font color="#ff0000"&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;With the output I want to .. = &lt;font color="#ff0000"&gt;|&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;and from this output only select the homedirectory and the name of the report in the report directory and name these &amp;quot;homedir&amp;quot; and &amp;quot;report&amp;quot; = &lt;font color="#ff0000"&gt;select @{e={$dirname};n=&amp;quot;homedir&amp;quot;},@{e={$_.name};n=&amp;quot;report&amp;quot;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;With the output I want to .. = &lt;font color="#ff0000"&gt;|&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;export this data to a csv file in systemroot\temp and name it reports.csv = &lt;font color="#ff0000"&gt;export-csv $env:systemroot\temp\reports.csv&lt;/font&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;So it's really simple. Just play arround and have fun.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;grt&lt;/div&gt;
&lt;div&gt;Dennis&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+the+beauty+of+simple+things%3a+listing+directory+content&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!112.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!112.entry</guid><pubDate>Wed, 27 Dec 2006 15:12:18 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!112/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!112.entry#comment</wfw:comment><dcterms:modified>2006-12-28T09:16:17Z</dcterms:modified></item><item><title>Citrix connection</title><link>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!111.entry</link><description>&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;For the one that doesn't know: Yes, you can do all the crazy stuff in citrix from the wonderfull world of the commandline as you can in the cmc....and more.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;A lot of stuff about the com, named MFCOM is written in the pdf &amp;quot;scripting metaframe&amp;quot;. (&lt;a href="http://support.citrix.com/article/CTX106885"&gt;http://support.citrix.com/article/CTX106885&lt;/a&gt;) This document is namely for doing stuff with vbscript, but with al little trail and error and a bit of smart thinking you can use this document to begin powershelling the citrix world. &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;I'll just post some simple scripts to begin with and I hope this wil trigger you to try things yourself and ofcourse.....share it !&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Let's do an automated enable and disable of a number of published applications.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;First we close them&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;#--&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;em&gt;&lt;font style="background-color:#333399" color="#999999"&gt;#first we have to connect to the farm. We do this with new-object and specify that it's a -com object. You don't have to specify the farm name, because it connects to the farm you're in by default.&lt;/font&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;$citrixfarm = new-object -com metaframecom.metaframefarm&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;&lt;em&gt;&lt;font color="#999999"&gt;#Then, the farm has to be initialized. &lt;br&gt;&lt;/font&gt;&lt;/em&gt;$citrixfarm.initialize(1)&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;&lt;em&gt;&lt;font color="#999999"&gt;#To close multiple published apps, we need al list of applications. I've put those in a text file. Note that you have to specify the distinguishedname of the application. So, for instance: Applications/Windows/Notepad&lt;br&gt;&lt;/font&gt;&lt;/em&gt;gc &amp;quot;c:\scripts\citrixapps\citrixapps.txt&amp;quot; |foreach &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;{&lt;br&gt;   $disting=$_&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;/em&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;   &lt;em&gt;&lt;font color="#999999"&gt;#To see the progress in the commandline I've put in the echo below&lt;br&gt;&lt;/font&gt;&lt;/em&gt;   echo &amp;quot;Busy closing --&amp;gt; &amp;quot;+$disting&lt;br&gt;   $citrixapps = $citrixfarm.applications|where {$_.DistinguishedName -like $disting}&lt;br&gt;   $citrixapps.enableapp = 0&lt;br&gt;   $citrixapps.savedata()&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;#--&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;And....that's all to close them down. Now we'll open them in pretty much the same way. Actually the only difference is putting &amp;quot;enableapp&amp;quot; to &amp;quot;1&amp;quot;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;#--&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;$citrixfarm = new-object -com metaframecom.metaframefarm&lt;br&gt;$citrixfarm.initialize(1)&lt;br&gt;gc c:\scripts\citrixapps\citrixapps.txt |foreach &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font style="background-color:#333399" color="#ffffff"&gt;{&lt;br&gt;   $disting=$_&lt;br&gt;   &amp;quot;Busy opening --&amp;gt; &amp;quot;+$disting&lt;br&gt;   $citrixapps = $citrixfarm.applications|where {$_.DistinguishedName -like $disting}&lt;br&gt;   $citrixapps.enableapp = 1&lt;br&gt;   $citrixapps.savedata()&lt;br&gt;}&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;#--&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;try and enjoy&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Dennis&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+Citrix+connection&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><category>Citrix</category><comments>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!111.entry#comment</comments><guid isPermaLink="true">http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!111.entry</guid><pubDate>Wed, 27 Dec 2006 13:44:28 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://dverweij.spaces.live.com/blog/cns!A3C75816DA1731F8!111/comments/feed.rss</wfw:commentRss><wfw:comment>http://dverweij.spaces.live.com/Blog/cns!A3C75816DA1731F8!111.entry#comment</wfw:comment><dcterms:modified>2006-12-28T13:39:04Z</dcterms:modified></item><item><title>Blog list: Powershell links</title><link>http://dverweij.spaces.live.com/Lists/cns!A3C75816DA1731F8!116</link><description>&lt;div&gt;&lt;p&gt;Powershell links&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;a href="http://blogs.msdn.com&amp;#47;powershell"&gt;Powershell team&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href="http://thepowershellguy.com&amp;#47;blogs&amp;#47;posh&amp;#47;"&gt;MOW&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href="http://keithhill.spaces.live.com&amp;#47;Blog&amp;#47;"&gt;Keith Hill&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href="http://msdn2.microsoft.com&amp;#47;en-us&amp;#47;library&amp;#47;ms714469.aspx"&gt;Powershell SDK&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href="http://www.microsoft.com&amp;#47;communities&amp;#47;newsgroups&amp;#47;en-us&amp;#47;default.aspx&amp;#63;dg&amp;#61;microsoft.public.windows.powershell"&gt;Powershell newsgroup&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href="http://www.microsoft.com&amp;#47;technet&amp;#47;scriptcenter&amp;#47;hubs&amp;#47;msh.mspx"&gt;Powershell scriptcenter&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href="http://www.microsoft.com&amp;#47;windowsserver2003&amp;#47;technologies&amp;#47;management&amp;#47;powershell&amp;#47;default.mspx"&gt;Powershell home&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href="http://www.technorati.com&amp;#47;"&gt;Technorati&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;a href="http://www.codeplex.com&amp;#47;Wiki&amp;#47;View.aspx&amp;#63;ProjectName&amp;#61;PowerShellCX"&gt;PowerShell Community Extensions&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-6645245869990399496&amp;page=RSS%3a+Blog+list%3a+Powershell+links&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=dverweij.spaces.live.com&amp;amp;GT1=dverweij"&gt;</description><guid isPermaLink="false">cns!A3C75816DA1731F8!116</guid><pubDate>Fri, 29 Dec 2006 08:34:48 GMT</pubDate><msn:type>bloglist</msn:type><live:type>bloglist</live:type><live:typelabel>Blog list</live:typelabel><cf:itemRSS>http://dverweij.spaces.live.com/Lists/cns!A3C75816DA1731F8!116/feed.rss</cf:itemRSS><dcterms:modified>2006-12-29T08:34:48Z</dcterms:modified></item></channel></rss>