<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Serge van den Oever [Macaw] : PowerShell</title><link>http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx</link><description>Tags: PowerShell</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>PowerShell: Return values from a function through reference parameters</title><link>http://weblogs.asp.net/soever/archive/2009/03/26/powershell-return-values-from-a-function-through-reference-parameters.aspx</link><pubDate>Thu, 26 Mar 2009 09:41:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7003526</guid><dc:creator>svdoever</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=7003526</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2009/03/26/powershell-return-values-from-a-function-through-reference-parameters.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;PowerShell has a special [ref] keyword to specify which parameters are used in a fuction to return values. It's usage is not directly clear however. &lt;/P&gt;
&lt;P mce_keep="true"&gt;If the&amp;nbsp;type of the variable to update is a value type, use the [ref] keyword in the declaration of the function parameter, this specifies that a "pointer" to the variable will be passed.&lt;/P&gt;
&lt;P mce_keep="true"&gt;To pass the "pointer" to the variable, use ([ref]$variable) to create the pointer, and pass this as parameter. To set the value of the value variable pointed to by the "pointer", use the .Value field.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Simple example to show what [ref] does:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;FONT face="Courier New" size=2&gt;C:\Program Files\PowerGUI&amp;gt; $zz = "hoi"&lt;BR&gt;C:\Program Files\PowerGUI&amp;gt; $xz = [ref]$zz&lt;BR&gt;C:\Program Files\PowerGUI&amp;gt; $xz&lt;BR&gt;Value &lt;BR&gt;----- &lt;BR&gt;hoi &lt;/P&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;
&lt;P&gt;C:\Program Files\PowerGUI&amp;gt; $xz.Value = "dag"&lt;BR&gt;C:\Program Files\PowerGUI&amp;gt; $zz&lt;BR&gt;dag&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;
&lt;P mce_keep="true"&gt;This is only required for value types, not is the type is a referece type like for example Hashtable.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Some sample code:&lt;/P&gt;
&lt;P mce_keep="true"&gt;function fn&lt;BR&gt;{&lt;BR&gt;param&lt;BR&gt;(&lt;BR&gt;[ref]$arg1,&lt;BR&gt;[ref]$arg2,&lt;BR&gt;$arg3&lt;BR&gt;)&lt;BR&gt;&lt;BR&gt;$arg1.Value = 1&lt;BR&gt;$arg2.Value = "overwrite"&lt;BR&gt;$arg3.key = "overwrite hash value" &lt;BR&gt;}&lt;BR&gt;&lt;BR&gt;$x = 0&lt;BR&gt;$y = "original"&lt;BR&gt;$z = @{"key" = "original hashvalue"}&lt;BR&gt;$x&lt;BR&gt;$y&lt;BR&gt;$z.key&lt;BR&gt;fn -arg1 ([ref]$x) -arg2 ([ref]$y) -arg3 $z&lt;BR&gt;$x &lt;BR&gt;$y&lt;BR&gt;$z.key&lt;BR&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7003526" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>Documenting PowerShell script code</title><link>http://weblogs.asp.net/soever/archive/2009/02/09/documenting-powershell-script-code.aspx</link><pubDate>Sun, 08 Feb 2009 23:17:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6895221</guid><dc:creator>svdoever</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=6895221</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2009/02/09/documenting-powershell-script-code.aspx#comments</comments><description>&lt;P&gt;The Macaw Solutions Factory contains a lot of PowerShell script code. A lot of the code is documented, but it is not documented in a consistent way because there were no documentation standards available for PowerShell 1.0, we only had the very complex XML based MAML documentation standard that was not useable for inline documentation.&lt;/P&gt;
&lt;P&gt;With the (upcoming) introduction of PowerShell 2.0, a new more readable documentation standard for PowerShell code is introduced. I did not find any formal documentation on it, only examples on the PowerShell team blog. There is even a script to create a weblog post out of a script containing this documentation format. See &lt;A href="http://blogs.msdn.com/powershell/archive/tags/Write-CommandBlogPost/default.aspx&amp;nbsp;for" mce_href="http://blogs.msdn.com/powershell/archive/tags/Write-CommandBlogPost/default.aspx&amp;nbsp;for"&gt;http://blogs.msdn.com/powershell/archive/tags/Write-CommandBlogPost/default.aspx&amp;nbsp;for&lt;/A&gt; this script and an example of the documentation format.&lt;/P&gt;
&lt;P&gt;The new documentation format uses a PowerShell 2.0 feature for multi-line comments:&lt;/P&gt;&lt;PRE&gt;&amp;lt;#
:
\#&amp;gt;&lt;/PRE&gt;
&lt;P&gt;Because this is not supported in PowerShell 1.0 , we will write the documentation as follows to remain compatible:&lt;/P&gt;&lt;PRE&gt;\#&amp;lt;#
\#:
\##&amp;gt;&lt;/PRE&gt;
&lt;P&gt;This will allows us to change the documentation by removing the superfluous # characters when the code-base is moved over to PowerShell 2.0 when it is released.&lt;/P&gt;
&lt;H3&gt;&lt;A class="" title=MSFDEV-DocumentingPowerShellscripts name=MSFDEV-DocumentingPowerShellscripts&gt;&lt;/A&gt;Documenting PowerShell scripts&lt;/H3&gt;
&lt;P&gt;Scripts can be provided with documentation in the following format:&lt;/P&gt;&lt;PRE&gt;#&amp;lt;#
#.Synopsis
#	Short description of the purpose of this script
#.Description
#	Extensive description of the script
#.Parameter X
#    Description or parameter X
#.Parameter Y
#    Description or parameter Y
#.Example
#	First example of usage of the script
#.Example
#	Second example of usage of the script
##&amp;gt;
param
(
	X,
	Y
)
:

function MyFunction
{
	#&amp;lt;#
	#.Synopsis
	#	Short description of the purpose of this function
	#.Description
	#	Extensive description of the function
	#.Parameter X
	#    Description or parameter X
	#.Parameter Y
	#    Description or parameter Y
	#.Example
	#	First example of usage of the function
	#.Example
	#	Second example of usage of the function
	##&amp;gt;
	param
	(
		X,
		Y
	)
	:
}

:&lt;/PRE&gt;
&lt;H3&gt;Automatically generating documentation&lt;/H3&gt;
&lt;P&gt;The next step is to automatically generate documentation on all our scripts based on the new documentation format.&lt;/P&gt;
&lt;P&gt;The best approach will possibly be to use PowerShell 2.0 to actually generate the documentation, because using PowerShell 2.0 we can parse PowerShell code. We can easily determine the functions and their parameters.&lt;/P&gt;
&lt;P&gt;A nice project for the future.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6895221" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>Powershell output capturing and text wrapping: strange quirks... solved!</title><link>http://weblogs.asp.net/soever/archive/2008/12/09/powershell-output-capturing-and-text-wrapping-strange-quirks-solved.aspx</link><pubDate>Tue, 09 Dec 2008 22:21:30 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6775760</guid><dc:creator>svdoever</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=6775760</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2008/12/09/powershell-output-capturing-and-text-wrapping-strange-quirks-solved.aspx#comments</comments><description>&lt;h3&gt;Summary&lt;/h3&gt;  &lt;p&gt;To capture (transcript) all output of a Powershell script, and control the way textwrapping is done, use the following approach from for exmaple a batch file or your Powershell code:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;PowerShell -Command&amp;#160; &amp;quot;`$host.UI.RawUI.BufferSize = new-object System.Management.Automation.Host.Size(512,50); `&amp;quot;c:\temp\testoutputandcapture.ps1`&amp;quot; -argument `&amp;quot;A value`&amp;quot;&amp;quot; &amp;gt;c:\temp\out.txt 2&amp;gt;&amp;amp;1 &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Note the '`' (backtick characters).&lt;/p&gt;  &lt;h3&gt;The problem: output capture and text wrap&lt;/h3&gt;  &lt;p&gt;Powershell is a great language, but I have been fighting and fighting with Powershell on two topics:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;to capture the output&lt;/li&gt;    &lt;li&gt;to get it output text in the max width that I want without unexpected wrapping&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;After reading the manuals you would think that the PowerShell transcripting possibilities are your stairways to heaven. You just start capturing output as follows:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;start-transcript &amp;quot;c:\temp\transcript.txt&amp;quot;&lt;/strong&gt;&lt;/li&gt;    &lt;li&gt;do your thing&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;stop-transcript&lt;/strong&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Try this with the following sample file &lt;strong&gt;c:\temp\testoutputandcapture.ps1&lt;/strong&gt;:&lt;/p&gt; &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;  &lt;pre class="code"&gt;&lt;span style="color: #5f9ea0"&gt;Start-Transcript &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;c:\temp\transcript.txt&amp;quot;
&lt;/span&gt;&lt;span style="color: blue"&gt;function &lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Output
&lt;/span&gt;&lt;span style="color: black"&gt;{
    &lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Write-Host &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;Write-Host&amp;quot;
    &lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Write-Output &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;Write-Output&amp;quot;
    &lt;/span&gt;&lt;span style="color: black"&gt;cmd.exe /c &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;echo Long long long long long long long long yes very long output from external command&amp;quot;
    &lt;/span&gt;&lt;span style="color: black"&gt;PowerShell -Command &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;Write-Error 'error string'&amp;quot;
&lt;/span&gt;&lt;span style="color: black"&gt;}
&lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Output
Stop-Transcript&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;When you execute this script you get the following output:&lt;/p&gt;

&lt;table border="1"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;pre&gt;PS C:\temp&amp;gt; C:\temp\testoutputandcapture.ps1
Transcript started, output file is c:\temp\transcript.txt
Write-Host
Write-Output
Long long long long long long long long yes very long output from external command&lt;br /&gt;&lt;font color="#ff0000"&gt;Write-Error 'error string' : error string
&lt;/font&gt;Transcript stopped, output file is C:\temp\transcript.txt&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;If we now look at the generated transcript file &lt;strong&gt;c:\temp\transcript.txt&lt;/strong&gt;:&lt;/p&gt;

&lt;table border="1"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;pre&gt;**********************
Windows PowerShell Transcript Start
Start time: 20081209001108
Username  : VS-D-SVDOMOSS-1\Administrator 
Machine	  : VS-D-SVDOMOSS-1 (Microsoft Windows NT 5.2.3790 Service Pack 2) 
**********************
Transcript started, output file is c:\temp\transcript.txt
Write-Host
Write-Output
**********************
Windows PowerShell Transcript End
End time: 20081209001108
**********************&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;The output from the external command (the texts &lt;strong&gt;Long long long long long long long long yes very long output from external command&lt;/strong&gt; and &lt;font color="#ff0000"&gt;&lt;strong&gt;Write-Error 'error string' : error string&lt;/strong&gt;&lt;/font&gt;)&amp;#160; is not captured!!!&lt;/p&gt;

&lt;h3&gt;Step one: piping output of external commands&lt;/h3&gt;

&lt;p&gt;This can be solved by appending &lt;strong&gt;| Write-Output&lt;/strong&gt; to external commands:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #5f9ea0"&gt;Start-Transcript &lt;/span&gt;&lt;span style="color: maroon"&gt;'c:\temp\transcript.txt'
&lt;/span&gt;&lt;span style="color: blue"&gt;function &lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Output
&lt;/span&gt;&lt;span style="color: black"&gt;{
    &lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Write-Host &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;Write-Host&amp;quot;
    &lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Write-Output &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;Write-Output&amp;quot;
    &lt;/span&gt;&lt;span style="color: black"&gt;cmd.exe /c &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;echo Long long long long long long long long yes very long output from external command&amp;quot; &lt;/span&gt;&lt;span style="color: black"&gt;| &lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Write-Output
    &lt;/span&gt;&lt;span style="color: black"&gt;PowerShell -Command &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;Write-Error 'error string'&amp;quot; &lt;/span&gt;&lt;span style="color: black"&gt;| &lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Write-Output
&lt;/span&gt;&lt;span style="color: black"&gt;}
&lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Output
Stop-Transcript&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;This will result in the following output:&lt;/p&gt;

&lt;table border="1"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;pre&gt;PS C:\temp&amp;gt; C:\temp\testoutputandcapture.ps1
Transcript started, output file is c:\temp\transcript.txt
Write-Host
Write-Output
Long long long long long long long long yes very long output from external command&lt;br /&gt;Write-Error 'error string' : error string
Transcript stopped, output file is C:\temp\transcript.txt&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;Note that the error string &lt;strong&gt;Write-Error 'error string' : error string &lt;/strong&gt;is not in red anymore.&lt;/p&gt;

&lt;p&gt;The resulting transcript file &lt;strong&gt;c:\temp\transcript.txt&lt;/strong&gt; now looks like:&lt;/p&gt;

&lt;table border="1"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;pre&gt;**********************
Windows PowerShell Transcript Start
Start time: 20081209220137
Username  : VS-D-SVDOMOSS-1\Administrator 
Machine	  : VS-D-SVDOMOSS-1 (Microsoft Windows NT 5.2.3790 Service Pack 2) 
**********************
Transcript started, output file is c:\temp\transcript.txt
Write-Host
Write-Output
Long long long long long long long long yes very long output from external command&lt;br /&gt;Write-Error 'error string' : error string
**********************
Windows PowerShell Transcript End
End time: 20081209220139
**********************&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;This is what we want in the transcript file, everything is captured, but we need to put &lt;strong&gt;| Write-Output&lt;/strong&gt; after every external command. This is way to cumbersome if you have large scripts. For example in our situation there is a BuildAndPackageAll.ps1 script that includes a lot of files and cosists in totla of thousands of lines of Powershell code. There must be a better way...&lt;/p&gt;

&lt;h3&gt;Transcripting sucks, redirection?&lt;/h3&gt;

&lt;p&gt;Ok, so transcript just does not do the job of capturing all output. Lets look at another method: good old redirection.&lt;/p&gt;

&lt;p&gt;We go back to our initial version of the script, and do &lt;strong&gt;c:\temp\testoutputandcapture.ps1&lt;/strong&gt; &lt;strong&gt;&amp;gt; c:\temp\out.txt&lt;/strong&gt;. This results in a &lt;strong&gt;c:\temp\out.txt&lt;/strong&gt; file with the following contents:&lt;/p&gt;

&lt;table border="1"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;pre&gt;Transcript started, output file is c:\temp\transcript.txt
Write-Output
Long long long long long long long long yes very long output from external command&lt;br /&gt;Write-Error 'error string' : error string
Transcript stopped, output file is C:\temp\transcript.txt&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;We are missing the &lt;strong&gt;Write-Host&lt;/strong&gt; output! Actually, the Write-Host is the only line ending up in the transcript file;-)&lt;/p&gt;

&lt;p&gt;This is not good enough, so another try, but now using the Powershell command-line host on the little modified script &lt;strong&gt;c:\temp\testoutputandcapture.ps1&lt;/strong&gt; that will showcase our next problem:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;function &lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Output
&lt;/span&gt;&lt;span style="color: black"&gt;{
    &lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Write-Host &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;Write-Host&amp;quot;
    &lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Write-Output &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;Write-Output Long long long long long long long long yes very long output from Write-Output&amp;quot;
    &lt;/span&gt;&lt;span style="color: black"&gt;cmd.exe /c &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;echo Long long long long long long long long yes very long output from external command&amp;quot;
    &lt;/span&gt;&lt;span style="color: black"&gt;PowerShell -Command &lt;/span&gt;&lt;span style="color: maroon"&gt;&amp;quot;Write-Error 'error string'&amp;quot;
&lt;/span&gt;&lt;span style="color: black"&gt;}
&lt;/span&gt;&lt;span style="color: #5f9ea0"&gt;Output
&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;We now do: &lt;strong&gt;Powershell -Command &amp;quot;c:\temp\testoutputandcapture.ps1&amp;quot;&lt;/strong&gt; &lt;strong&gt;&amp;gt; c:\temp\out.txt&lt;/strong&gt; &lt;strong&gt;2&amp;gt;&amp;amp;1&lt;/strong&gt; (2&amp;gt;&amp;amp;1 means: redirect stderr to stdout). We capture stderr as well, you never know where it is good for. This results in:&lt;/p&gt;

&lt;table border="1"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;pre&gt;Write-Host
Write-Output Long long long long long long long l
ong yes very long output from Write-Output
Long long long long long long long long yes very long output from external command&lt;br /&gt;Write-Error 'error string' : error string&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;h3&gt;I hate automatic text wrapping&lt;/h3&gt;

&lt;p&gt;As you may notice some strange things happen here:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;A long output line generated by PowerShell code is wrapped (at 50 characters in the above case)&lt;/li&gt;

  &lt;li&gt;A long line generated by an external command, called from Powershell is not truncated&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The reason the Powershell output is wrapped at 50 characters is because the dos box I started the command from is set to 50 characters wide. I did this on purpose to proof a case. Ok, so you can set your console window really wide, so no truncation is done? True. But you are not always in control of that. For example if you call your Powershell script from a batch file which is executed through Windows Explorer or through an external application like in my case CruiseControl.Net where I may provide an external command.&lt;/p&gt;

&lt;h3&gt;Powershell -PSConfigFile?... no way!&lt;/h3&gt;

&lt;p&gt;I hoped the solution would be in an extra parameter to the Powershell command-line host: -PSConfigFile. You can specify a Powershell console configuration XML file here that you can generate with the command &lt;strong&gt;Export-Console ConsoleConfiguration&lt;/strong&gt;. This results in the &lt;strong&gt;ConsoleConfiguration.psc1&lt;/strong&gt; XML file:&lt;/p&gt;

&lt;table border="1"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;pre&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;
&amp;lt;PSConsoleFile ConsoleSchemaVersion=&amp;quot;1.0&amp;quot;&amp;gt;
  &amp;lt;PSVersion&amp;gt;1.0&amp;lt;/PSVersion&amp;gt;
  &amp;lt;PSSnapIns /&amp;gt;
&amp;lt;/PSConsoleFile&amp;gt;&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;I searched and searched for documentation on extra configuration&amp;#160; like console width or something, but documentation on this is really sparse. So I fired up good old Reflector. After some drilling I ended up with the following code for the &lt;strong&gt;Export-Console &lt;/strong&gt;command:&lt;/p&gt;

&lt;table border="1"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;pre&gt;internal static void WriteToFile(MshConsoleInfo consoleInfo, string path)
{
    using (tracer.TraceMethod())
    {
        _mshsnapinTracer.WriteLine(&amp;quot;Saving console info to file {0}.&amp;quot;, new object[] { path });        &lt;br /&gt;         XmlWriterSettings settings = new XmlWriterSettings();
        settings.Indent = true;
        settings.Encoding = Encoding.UTF8;
        using (XmlWriter writer = XmlWriter.Create(path, settings))
        {
            writer.WriteStartDocument();
            writer.WriteStartElement(&amp;quot;PSConsoleFile&amp;quot;);
            writer.WriteAttributeString(&amp;quot;ConsoleSchemaVersion&amp;quot;, &amp;quot;1.0&amp;quot;);
            writer.WriteStartElement(&amp;quot;PSVersion&amp;quot;);
            writer.WriteString(consoleInfo.PSVersion.ToString());
            writer.WriteEndElement();
            writer.WriteStartElement(&amp;quot;PSSnapIns&amp;quot;);
            foreach (PSSnapInInfo info in consoleInfo.ExternalPSSnapIns)
            {
                writer.WriteStartElement(&amp;quot;PSSnapIn&amp;quot;);
                writer.WriteAttributeString(&amp;quot;Name&amp;quot;, info.Name);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Close();
        }
        _mshsnapinTracer.WriteLine(&amp;quot;Saving console info succeeded.&amp;quot;, new object[0]);    }
}&lt;/pre&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;So the XML that we already saw is all there is... a missed chance there.&lt;/p&gt;

&lt;h3&gt;A custom command-line PowerShell host?&lt;/h3&gt;

&lt;p&gt;I have written a few Powershell hosts already, for example one hosted into Visual Studio, and there I encountered the same wrapping issue which I solved by the following implementation of the PSHostRawUserInterface:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Management.Automation.Host;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;Macaw.SolutionsFactory.DotNet3.IntegratedUI.Business.Components.Powershell
{
    &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
    /// &lt;/span&gt;&lt;span style="color: green"&gt;Implementation of PSHostRawUserInterface.
&lt;/span&gt;&lt;span style="color: green"&gt;    &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;
    &lt;/span&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PowershellHostRawUI &lt;/span&gt;: PSHostRawUserInterface
    {
        :&lt;/pre&gt;

&lt;pre class="code"&gt;        &lt;span style="color: blue"&gt;public override &lt;/span&gt;Size BufferSize
        {
            &lt;span style="color: blue"&gt;get
            &lt;/span&gt;{   
                &lt;span style="color: green"&gt;// The width is the width of the output, make it very wide!
                &lt;/span&gt;&lt;span style="color: blue"&gt;return new &lt;/span&gt;Size(512,1);
            }
            &lt;span style="color: blue"&gt;set
            &lt;/span&gt;{
                &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;BufferSize - set: The method or operation is not implemented.&amp;quot;&lt;/span&gt;);
            }
        }&lt;/pre&gt;

&lt;pre class="code"&gt;        :
    }
}&lt;/pre&gt;

&lt;p&gt;I solved transcripting in my own Powershell hosts by capturing all text output done by Powershell through custom implemented functions for the PSHostUserInterface you need to implement anyway, works like a breeze.&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;The solution, without custom host...&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;I was just getting started to solve the transcripting and wrapping issues by implementing again a Powershell host, but now a command-line Powershell host when I did one last digging step. What is you can set the &lt;strong&gt;BufferSize&lt;/strong&gt; at runtime in your Powershell code. And the answer is.... yes you can! Through the &lt;strong&gt;$host&lt;/strong&gt; Powershell variable: &lt;strong&gt;$host.UI.RawUI.BufferSize = new-object System.Management.Automation.Host.Size(512,50)&lt;/strong&gt;. This says that the output may be max 512 chars wide, the height may not be 1 (as in my code), bu this height value is not important in this case. It is used for paging in a interactive shell.&lt;/p&gt;

&lt;p&gt;And this last statement gives us full control and solves all our transcripting and wrapping issues:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PowerShell -Command&amp;#160; &amp;quot;`$host.UI.RawUI.BufferSize = new-object System.Management.Automation.Host.Size(512,50); `&amp;quot;c:\temp\testoutputandcapture.ps1`&amp;quot; -argument `&amp;quot;A value`&amp;quot;&amp;quot; &amp;gt;c:\temp\out.txt 2&amp;gt;&amp;amp;1 &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And this concludes a long journey into the transcripting and wrapping caves of Powershell. I hope this will save you the days of searching we had to put into it to tame the great but naughty Powershell beast.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6775760" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>Powershell: Generate simple XML from text, useful for CruiseControl.Net merge files</title><link>http://weblogs.asp.net/soever/archive/2008/12/08/powershell-generate-simple-xml-from-text-useful-for-cruisecontrol-net-merge-files.aspx</link><pubDate>Mon, 08 Dec 2008 00:34:17 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6770330</guid><dc:creator>svdoever</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=6770330</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2008/12/08/powershell-generate-simple-xml-from-text-useful-for-cruisecontrol-net-merge-files.aspx#comments</comments><description>&lt;p&gt;I had the problem that I need to include ordinary text files into the CruiseControl.Net build output log file. This log file is a merge of multiple files in xml format. So I needed to get some text files into a simple xml format. I ended up with the following Powershell code to convert an input text file to a simple output xml file &lt;/p&gt;  &lt;p&gt;Powershell code:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="1"&gt;function Convert-XmlString     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; param      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; (      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [string]$text      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; )      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; # Escape Xml markup characters (&lt;/font&gt;&lt;a href="http://www.w3.org/TR/2006/REC-xml-20060816/#syntax)"&gt;&lt;font face="Courier New" color="#0000ff" size="1"&gt;http://www.w3.org/TR/2006/REC-xml-20060816/#syntax)&lt;/font&gt;&lt;/a&gt;    &lt;br /&gt;&lt;font face="Courier New" color="#0000ff" size="1"&gt;&amp;#160;&amp;#160;&amp;#160; $text.replace('&amp;amp;', '&amp;amp;amp;').replace(&amp;quot;'&amp;quot;, '&amp;amp;apos;').replace('&amp;quot;', '&amp;amp;quot;').replace('&amp;lt;', '&amp;amp;lt;').replace('&amp;gt;', '&amp;amp;gt;')     &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="1"&gt;function Convert-TextToXml     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; param      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; (      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $rootNode = 'root',      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $node = 'node',      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $path = $(Throw 'Missing argument: path'),      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $destination = $(Throw 'Missing argument: destination')      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; )      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Get-Content -Path $path | ForEach-Object `      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -Begin {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Write-Output &amp;quot;&amp;lt;$rootNode&amp;gt;&amp;quot;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } `      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -Process {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Write-Output &amp;quot;&amp;#160; &amp;lt;$node&amp;gt;$(Convert-XmlString -text $_)&amp;lt;/$node&amp;gt;&amp;quot;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } `      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -End {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Write-Output &amp;quot;&amp;lt;/$rootNode&amp;gt;&amp;quot;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } | Set-Content -Path $destination -Force      &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;You can call this code as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="1"&gt;Convert-TextToXml -rootNode 'BuildAndPackageAll' -node 'message' -path 'c:\temp\in.txt' -destination 'c:\temp\out.xml'&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;where the file c:\temp\in.txt:&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff"&gt;This is line 1     &lt;br /&gt;This is a line with the characters &amp;lt;, &amp;gt;, &amp;amp;, ' and &amp;quot;      &lt;br /&gt;This is line 3&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Will be converted the the file c:\temp\out.xml:&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000ff"&gt;&amp;lt;BuildAndPackageAll&amp;gt;     &lt;br /&gt;&amp;#160; &amp;lt;message&amp;gt;This is line 1&amp;lt;/message&amp;gt;      &lt;br /&gt;&amp;#160; &amp;lt;message&amp;gt;This is a line with the characters &amp;amp;lt;, &amp;amp;gt;, &amp;amp;amp;, &amp;amp;apos; and &amp;amp;quot;&amp;lt;/message&amp;gt;      &lt;br /&gt;&amp;#160; &amp;lt;message&amp;gt;This is line 3&amp;lt;/message&amp;gt;      &lt;br /&gt;&amp;lt;/BuildAndPackageAll&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6770330" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>Post to self: getting the directory where the CLR is installed in PowerShell</title><link>http://weblogs.asp.net/soever/archive/2008/08/08/post-to-self-getting-the-directory-where-the-clr-is-installed-in-powershell.aspx</link><pubDate>Fri, 08 Aug 2008 08:55:25 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6496807</guid><dc:creator>svdoever</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=6496807</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2008/08/08/post-to-self-getting-the-directory-where-the-clr-is-installed-in-powershell.aspx#comments</comments><description>&lt;p&gt;[System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;will return a path like: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6496807" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>C:\Program Files\Reference Assemblies for assemblies to reference in your code</title><link>http://weblogs.asp.net/soever/archive/2008/07/20/c-program-files-reference-assemblies-for-assemblies-to-reference-in-your-code.aspx</link><pubDate>Sun, 20 Jul 2008 20:35:01 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6424839</guid><dc:creator>svdoever</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=6424839</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2008/07/20/c-program-files-reference-assemblies-for-assemblies-to-reference-in-your-code.aspx#comments</comments><description>&lt;p&gt;I just stumbles across a &amp;quot;new&amp;quot; concept of Microsoft. In the &lt;strong&gt;C:\Program Files\Reference Assemblies&lt;/strong&gt; folder Microsoft installs assemblies for products that can be referenced from your code. Instead of referencing assemblies directly from the GAC or copying an assembly from an installation folder or the GAC to your project for reference, you can now reference the assemblies in this folder.&lt;/p&gt;  &lt;p&gt;We have a similar approach in our Macaw Solutions Factory where we have a _SharedAssemblies folder to keep track of all external assemblies to reference. We prefer to keep the assemblies with the source that is checked into source control, because otherwise it is possible that a build server does not contain the expected assemblies when compiling a checked-out solution and can't successfully compile the solution.&lt;/p&gt;  &lt;p&gt;On the MsBuild team blog you can read more about this feature that happened to be with us since the .Net 3.0 framework:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/msbuild/archive/2007/04/12/new-reference-assemblies-location.aspx" href="http://blogs.msdn.com/msbuild/archive/2007/04/12/new-reference-assemblies-location.aspx"&gt;http://blogs.msdn.com/msbuild/archive/2007/04/12/new-reference-assemblies-location.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Also other applications like PowerShell keep their assemblies to reference in this location.&amp;#160; &lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6424839" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>Edit file in Wss3 web application with SharePoint Designer blows up your web site</title><link>http://weblogs.asp.net/soever/archive/2008/01/29/edit-file-in-wss3-web-application-with-sharepoint-designer-blows-up-your-web-site.aspx</link><pubDate>Tue, 29 Jan 2008 10:21:02 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5670415</guid><dc:creator>svdoever</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=5670415</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2008/01/29/edit-file-in-wss3-web-application-with-sharepoint-designer-blows-up-your-web-site.aspx#comments</comments><description>&lt;p&gt;I wanted to create a simple html file in the root of my Wss3 web application, so I created an empty file test.htm. I double clicked te file and because I have SharePoint Designer installed, it is the default editor for .htm files. I put some test into the .htm file along the lines of &amp;quot;Hello world!&amp;quot;, and boom: my Wss3 web application is dead. I get the following error:&lt;/p&gt;  &lt;h3&gt;&lt;font color="#0000ff"&gt;Server Error in '/' Application.      &lt;hr width="100%" size="1" /&gt;&lt;/font&gt;&lt;/h3&gt;  &lt;h4&gt;&lt;i&gt;&lt;font color="#0000ff"&gt;Parser Error&lt;/font&gt;&lt;/i&gt;&lt;/h4&gt; &lt;font color="#0000ff"&gt;&lt;b&gt;Description: &lt;/b&gt;An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.     &lt;br /&gt;&lt;b&gt;Parser Error Message: &lt;/b&gt;Data at the root level is invalid. Line 1, position 1.    &lt;br /&gt;&lt;b&gt;Source Error:&lt;/b&gt;&lt;/font&gt;  &lt;p&gt;&lt;code&gt;&lt;/code&gt;    &lt;pre&gt;&lt;font color="#0000ff"&gt;Line 1:  &amp;lt;browsers&amp;gt;
Line 2:      &amp;lt;browser id=&amp;quot;Safari2&amp;quot; parentID=&amp;quot;Safari1Plus&amp;quot;&amp;gt;
Line 3:          &amp;lt;controlAdapters&amp;gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;&lt;font color="#0000ff"&gt;&lt;b&gt;Source File: &lt;/b&gt;/App_Browsers/compat.browser&lt;b&gt;&amp;#160;&amp;#160;&amp;#160; Line: &lt;/b&gt;1 &lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font color="#0000ff"&gt;
    &lt;hr width="100%" size="1" /&gt;&lt;b&gt;Version Information:&lt;/b&gt; Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;After some searching I found what happened:&lt;/p&gt;

&lt;p&gt;When you open a file with SharePoint Designer, it creates all kind of FrontPage Server Extension functionality in your web application. One thing it does it that it creates a &lt;strong&gt;_vti_cnf&lt;/strong&gt; folder in every folder you have in your web application. If you remove all these folders you fix your problem.&lt;/p&gt;

&lt;p&gt;I don't know of a handy DOS command to delete all these folders recursively, but with some PowerShell I solved the problem.&lt;/p&gt;

&lt;p&gt;Open a PowerShell prompt, set the current directory to the folder hosting your web application and execute the following command to see the &amp;quot;damage&amp;quot;:&lt;/p&gt;

&lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="1"&gt;PS C:\Inetpub\wwwroot\wss\VirtualDirectories\wss3dev&amp;gt; get-childitem -path . -name _vti_cnf -recurse
    &lt;br /&gt;_vti_cnf

    &lt;br /&gt;App_Browsers\_vti_cnf

    &lt;br /&gt;App_GlobalResources\_vti_cnf

    &lt;br /&gt;aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\CSs\_vti_cnf

    &lt;br /&gt;aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\html\_vti_cnf

    &lt;br /&gt;aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\Images\ToolBar\_vti_cnf

    &lt;br /&gt;aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\Images\Tree\_vti_cnf

    &lt;br /&gt;aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3\JS\_vti_cnf

    &lt;br /&gt;wpresources\_vti_cnf

    &lt;br /&gt;_app_bin\_vti_cnf&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;Now execute the following PowerShell command to kill all these folders and become a happy camper again:&lt;/p&gt;

&lt;p&gt;&lt;font face="Courier New" color="#0000ff" size="1"&gt;PS C:\Inetpub\wwwroot\wss\VirtualDirectories\wss3dev&amp;gt;&lt;/font&gt; &lt;font face="Courier New" color="#0000ff" size="1"&gt;get-childitem -path . -name _vti_cnf -recurse | % { remove-item -Path $_ -recurse }&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5670415" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>SharePoint stsadm.exe and the infamous "Command line error"</title><link>http://weblogs.asp.net/soever/archive/2007/12/22/sharepoint-stsadm-exe-and-the-infamous-quot-command-line-error-quot.aspx</link><pubDate>Sat, 22 Dec 2007 00:11:30 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5485210</guid><dc:creator>svdoever</dc:creator><slash:comments>17</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=5485210</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2007/12/22/sharepoint-stsadm-exe-and-the-infamous-quot-command-line-error-quot.aspx#comments</comments><description>&lt;p&gt;The SharePoint command-line utility stsadm.exe was driving me crazy for the last two days. I'm automating all kind of this from PowerShell scripts, but I got the error "Command line error" while I was absolutely sure that what I was doing was correct. I did &lt;strong&gt;stsadm.exe -o deletesolution foobar.wsp&lt;/strong&gt;. And the problem was: character encoding...&lt;/p&gt; &lt;p&gt;First I thought it was a problem with the way I executed this command from PowerShell. When I copied over the command to a different script it worked. What!!!??? Then I copied it over to the cmd.exe shell on the command line and I got the same error.&lt;/p&gt; &lt;p&gt;I started searching on Google and came accross &lt;a href="http://sharepointxperience.blogspot.com/2007/07/stsadm-command-line-error.html" target="_blank"&gt;this&lt;/a&gt; blogpost. It said it had something to do with &lt;strong&gt;encoding&lt;/strong&gt;. The blog post also pointed to &lt;a href="http://blogs.msdn.com/sharepoint/archive/2007/02/24/updated-installation-guide-for-the-20-server-admin-application-templates-for-wss-3-0.aspx" target="_blank"&gt;this&lt;/a&gt; blog post where people responded in the contents with the most hillarious solutions like:&lt;/p&gt; &lt;p&gt;If I type STSADM.EXE it works, while STSADM.exe does not work, or that a solution file must be in the same folder as stsadm.exe. Read the comments, it is fun how far off people can get.&lt;/p&gt; &lt;p&gt;Another post mentioning the problem is &lt;a href="http://www.tech-archive.net/Archive/SharePoint/microsoft.public.sharepoint.portalserver/2006-08/msg00651.html" target="_blank"&gt;this discussion thread&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;The problem happened to be in the encoding. One way or the other it is possible to get different encodings while typing in the same command multiple times in the same cmd.exe shell. Don't ask me how.&lt;/p&gt; &lt;p&gt;If you have problems, type your text in an editor like &lt;a href="http://notepad-plus.sourceforge.net/"&gt;Notepad++&lt;/a&gt;, and switch between "Encode in ANSI" and "Encode in UTF-8" (it is under the Format menu in Notepad++). You see (sometimes)the dash(-) in &lt;em&gt;stsadm &lt;strong&gt;-&lt;/strong&gt;o command...&lt;/em&gt; change from '-' to a strange little block... There is the problem. The dash is not always a dash, it is a hyphen... And stsadm then thinks that no command is specified. Remove the strange block, type a hyphen while is&amp;nbsp;UTF-8 encoding, copy that and bingo!! It works.&lt;/p&gt; &lt;p&gt;Ok, how to repeat this:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Start Notepad++, set encoding to ANSI&lt;/li&gt; &lt;li&gt;Make sure the path to stsadm.exe is in your path environment variable (or use full path)&lt;/li&gt; &lt;li&gt;Type &lt;strong&gt;stsadm -o deletesolution foobar.wsp&lt;/strong&gt;&lt;/li&gt; &lt;li&gt;Start cmd.exe&lt;/li&gt; &lt;li&gt;Copy the text over and press enter: voila, Command line error.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;The strange thing is that even if you remove the dash (-), and type it again, it still gives errors. I have no clue why.&lt;/p&gt; &lt;p&gt;This dash/hypen thing is a common problem if you search Google, for more info see for example:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://www.celestialsoftware.net/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic;f=1;t=000048" target="_blank"&gt;Topic: Issue with UTF8 and the encoding...&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.cs.tut.fi/~jkorpela/dashes.html" target="_blank"&gt;A whole article of hyphens and dashes&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5485210" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://weblogs.asp.net/soever/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>PowerShell Exception handling using "Trap" explained - links</title><link>http://weblogs.asp.net/soever/archive/2007/11/22/powershell-exception-handling-using-quot-trap-quot-explained-links.aspx</link><pubDate>Thu, 22 Nov 2007 15:53:30 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5312436</guid><dc:creator>svdoever</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=5312436</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2007/11/22/powershell-exception-handling-using-quot-trap-quot-explained-links.aspx#comments</comments><description>&lt;p&gt;PowerShell has powerful exception handling, but it is badly documented and takes while to understand what the heck they actually want to do to wire up the exception handling.&lt;/p&gt; &lt;p&gt;I'm normally not such a link poster, this is more of a "post-to-self" item that might be useful for others as well.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;See &lt;a href="http://huddledmasses.org/trap-exception-in-powershell/" target="_blank"&gt;Trap [Exception] { “In PowerShell” }&lt;/a&gt; for a very good explantation&lt;/li&gt; &lt;li&gt;See &lt;a href="http://weblogs.asp.net/adweigert/archive/2007/10/10/powershell-try-catch-finally-comes-to-life.aspx" target="_blank"&gt;PowerShell: Try...Catch...Finally Comes To Life&lt;/a&gt; for a Try/Catch/Finally implementation in PowerShell for the more c# oriented developers&lt;/li&gt;&lt;/ul&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5312436" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>Powershell: Is a SharePoint solution installed or deployed?</title><link>http://weblogs.asp.net/soever/archive/2007/10/10/powershell-is-a-sharepoint-solution-installed-or-deployed.aspx</link><pubDate>Wed, 10 Oct 2007 18:39:23 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:4518204</guid><dc:creator>svdoever</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=4518204</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2007/10/10/powershell-is-a-sharepoint-solution-installed-or-deployed.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="color: rgb(0,0,0)"&gt;I was having some fun with PowerShell to talks against the SharePoint object model. I needed to know if a SharePoint solution was installed and if it was deployed. I got to the code below. Might be handy for someone to see how easy it is to&amp;nbsp;get info out of SharePoint.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="color: rgb(0,0,0)"&gt;And the purpose I need it for? In our Macaw Solutions Factory we have a development build and a package build. Development build for SharePoint deploys everything to the bin folder of one or more web applications. Package build&amp;nbsp;creates a solution package (.wsp file) that does install assemblies to the GAC. If this solutions package is deployed on the development machine, we want to detect that, because you will not&amp;nbsp;see any changes after compile in a development build. The GAC assemblies have precedence over the assemblies in the web application bin folder.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="color: rgb(0,0,0)"&gt;So here is the code, have fun with it.&lt;/span&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,0)"&gt;[void][reflection.assembly]::LoadWithPartialName(&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;Microsoft.SharePoint&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;)

&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;function&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; global:&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;Test-SharePointSolution&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
{
    param
    (
        &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solutionName&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;(throw &lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;Missing: solutionName&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;),
        [&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;switch&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;]&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$installed&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;,
        [&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;switch&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;]&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$deployed&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
    )
    
    &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; (&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;!&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solutionName&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;.EndsWith(&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;.cab&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;) &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;or&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solutionName&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;.EndsWith(&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;.wsp&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;) &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;or&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solutionName&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;.EndsWith(&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;.wpp&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;)))
    {
        throw &lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;solution name '$solutionName' should end with .cab, .wsp or .wpp&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
    }
    
    &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; (&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$installed&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;and&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$deployed&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;)
    {
        throw &lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;Select either the '-installed' switch parameter or the '-deployed' switch parameter, not both at the same time&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
    }
    
    &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$farm&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; [Microsoft.SharePoint.Administration.SPFarm]::get_Local()
    &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solutions&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$farm&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;.get_Solutions()
    &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solutioncheck&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$false&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
    &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;foreach&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; (&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solution&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;in&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solutions&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;)
    {
        &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; (&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solution&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;.Name &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;-ieq&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solutionName&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;)
        {
            &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; (&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$deployed&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;)
            {
                &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solutioncheck&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solution&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;.Deployed
            }
            &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;else&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
            {
                &lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt; installed, is always true if we get here&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;                &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solutioncheck&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$true&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
            }
            &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;break&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        }
    }
    &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$solutioncheck&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
}

&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;Test-SharePointSolution&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;solutionName&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; wikidiscussionsolution.wsp &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;installed&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;Test-SharePointSolution&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;solutionName&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; wikidiscussionsolution.wsp &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;deployed&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=4518204" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>PowerShell: Creating a SharePoint solution package (WSP file) with CAS</title><link>http://weblogs.asp.net/soever/archive/2007/10/10/powershell-creating-a-sharepoint-solution-package-wsp-file-with-cas.aspx</link><pubDate>Wed, 10 Oct 2007 18:31:23 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:4518195</guid><dc:creator>svdoever</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=4518195</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2007/10/10/powershell-creating-a-sharepoint-solution-package-wsp-file-with-cas.aspx#comments</comments><description>&lt;p&gt;I need to add some code access security information to a SharePoint solution package manifest file. Given the assembly file we can retrieve the required assembly info, and with some xml magic in PowerShell create some result xml. It is not actually the exact code I use in my solution, but it shows the job...&lt;/p&gt; &lt;p&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt; function: GetAssemblyInfo&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt; Arguments: $assemblyFile - path to assembly file to determine information from&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt; Returns: Hashtable with the following keys: PublicKeyBlob, Name, Version&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;function&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; global:GetAssemblyInfo&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; param&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$assemblyFile&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;(Throw&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;Missing: assemblyFile&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; (&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;!&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;Test-Path&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;Path&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$assemblyFile&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;))&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Throw&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;Assembly file '$assemblyFile' does not exist&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt; Secutil returns:&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;Line 0: Microsoft (R) .NET Framework SecUtil 2.0.50727.42&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;Line 1: Copyright (c) Microsoft Corporation.&amp;nbsp; All rights reserved.&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;Line 2:&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;Line 3: Public Key =&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;Line 4: 0x00240000048000009400000006020000002400005253413100040000010001003BBC200DC39F9419851471C4AF65A91540C5904D72694CDE6DF63427FAD8D180630538338E557D90BA4F18A2EF6F44F3A53A5C7CFE625F4954D53B4FF9CF700226FDF13F04731EDED323B1821BA38C5F310231007E7AF862F497174A127BD42C0FA4FAFF1154910B48E177E090888A7745145ED4F4F7BB75D28D6616961A71E3&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;Line 5: Name =&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;Line 6: Macaw.Mast.Wss3.Templates.Presentation.WebAppUI&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;Line 7: Version =&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;Line 8: 1.0.0.0&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;#&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;Line 9: Success&lt;/span&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;br&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$secutilExe&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\SecUtil.exe&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$resultLines&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; (&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$secutilExe&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;hex&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;s&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$assemblyFile&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; (&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$resultLines&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;[&lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;9&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;]&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;-ne&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;Success&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Throw&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;secutil.exe can't determine assembly information from assembly file '$assemblyFile', secutil.exe command failed&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @{&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;PublicKeyBlob&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$resultLines&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;[&lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;4&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;];&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;Name&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$resultLines&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;[&lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;6&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;];&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;Version&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$resultLines&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;[&lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;8&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;] }&lt;br&gt;}&lt;br&gt;&lt;/span&gt;&lt;/p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,128,0)"&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$assemblyFile&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;C:\Inetpub\wwwroot\wss\VirtualDirectories\1000\bin\Macaw.Mast.Wss3.Templates.Presentation.WebAppUI.dll&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$result&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; GetAssemblyInfo &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;assemblyFile&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$assemblyFile&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$result&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;This will result in the following output:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/soever/WindowsLiveWriter/PowerShellSharePointCASassemblyinformati_BD3/secutilinfo2.jpg" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="100" src="http://weblogs.asp.net/blogs/soever/WindowsLiveWriter/PowerShellSharePointCASassemblyinformati_BD3/secutilinfo_thumb.jpg" width="869" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;We can now create out code access security information (in this case in a SharePoint solution package manifest.xml file with code similar to the following code:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(0,0,255)"&gt;$assemblyInfo&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; GetAssemblyInfo &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,128,128)"&gt;assemblyFile&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$assemblyFile&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$policyItem&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;@"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;
&amp;lt;PolicyItem&amp;gt;
    &amp;lt;PermissionSet class=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;NamedPermissionSet&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt; version=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt; Description=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;Macaw Solution Factory generated permissionSet&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt; Name=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$assemblyInfo&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;.Name)&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;PermissionSet&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;WebPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
            &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;ConnectAccess&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
                &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;URI uri&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;`$OriginHost`$&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
            &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;ConnectAccess&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;SmtpPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Access&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;Connect&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;SharePointPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; ObjectModel&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;True&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;PrintingPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Level&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;DefaultPrinting&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;FileIOPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Read&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;`$AppDir`$&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Write&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;`$AppDir`$&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Append&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;`$AppDir`$&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; PathDiscovery&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;`$AppDir`$&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;EnvironmentPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Read&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;TEMP;TMP;USERNAME;OS;COMPUTERNAME&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;SqlClientPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Unrestricted&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;true&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;SecurityPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Flags&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;Assertion, Execution, ControlThread, ControlPrincipal, RemotingConfiguration&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;DnsPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Unrestricted&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;true&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;WebPartPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Connections&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;True&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;AspNetHostingPermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Level&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;Medium&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
        &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;IPermission class&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;IsolatedStorageFilePermission&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Allowed&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;AssemblyIsolationByUser&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; UserQuota&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;9223372036854775807&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
    &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;PermissionSet&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;Assemblies&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
	&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;Assembly Name&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;$($assemblyInfo.Name)&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; Version&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;$($assemblyInfo.Version)&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; PublicKeyBlob&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;$($assemblyInfo.PublicKeyBlob)&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;Assemblies&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;PolicyItem&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;@&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$xmltext&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;@"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;
&amp;lt;?xml version=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;1.0&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt; encoding=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;utf&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;-&lt;/span&gt;&lt;span style="color: rgb(255,0,0)"&gt;8&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;?&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;Solution DeploymentServerType&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;WebFrontEnd&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; SolutionId&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;2244989E-9DA9-4a5d-9767-0D8F387181B7&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; ResetWebServer&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;true&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
    &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;CodeAccessSecurity&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
    &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;CodeAccessSecurity&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;Solution&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;@&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
[xml]&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$xmlDoc&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt; &lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$xmltext&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;
&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$xmlDoc&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;.SelectSingleNode(&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;/Solution/CodeAccessSecurity&lt;/span&gt;&lt;span style="color: rgb(0,0,128)"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;).set_InnerXml(&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$policyItem&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;)
&lt;/span&gt;&lt;span style="color: rgb(0,0,255)"&gt;$xmlDoc&lt;/span&gt;&lt;span style="color: rgb(0,0,0)"&gt;.get_InnerXml()
&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This will results in the following output:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/soever/WindowsLiveWriter/PowerShellSharePointCASassemblyinformati_BD3/manifestxml2.jpg" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="465" src="http://weblogs.asp.net/blogs/soever/WindowsLiveWriter/PowerShellSharePointCASassemblyinformati_BD3/manifestxml_thumb.jpg" width="914" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;In the production of a real SharePoint solution package a lot more is happening, but this showcases some of the PowerShell power you can use to get the job done.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=4518195" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>PowerShell: get SharePoint Central Administration web application path</title><link>http://weblogs.asp.net/soever/archive/2007/08/17/powershell-get-sharepoint-central-administration-web-application-path.aspx</link><pubDate>Fri, 17 Aug 2007 11:58:33 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:3533401</guid><dc:creator>svdoever</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=3533401</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2007/08/17/powershell-get-sharepoint-central-administration-web-application-path.aspx#comments</comments><description>&lt;p&gt;One of those things that you find out, forget, and never find back. So its more a post to self;-)&lt;/p&gt; &lt;p&gt;[void][reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint")&lt;br&gt;[Microsoft.SharePoint.Administration.SPAdministrationWebApplication]::Local.IisSettings.get_Item(0).Path.FullName&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=3533401" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>Generate a list of GUID's</title><link>http://weblogs.asp.net/soever/archive/2007/05/31/generate-a-list-of-guid-s.aspx</link><pubDate>Wed, 30 May 2007 23:07:36 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:2694224</guid><dc:creator>svdoever</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=2694224</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2007/05/31/generate-a-list-of-guid-s.aspx#comments</comments><description>&lt;p&gt;Sometimes you just need a lot of GUID's while programming.&amp;nbsp; Ofcourse you could use the Visual Studio GUID tool, bu that is a lot of work.&lt;/p&gt; &lt;p&gt;Open a PowerShell console, and paste in the following line to get a list of 100 guid's:&lt;/p&gt; &lt;p&gt;$i=100; while ($i-- -gt 0) { Write-Host ([System.Guid]::NewGuid()) }&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=2694224" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>Factories @ Macaw - the DotNed presentation of april 26, 2007</title><link>http://weblogs.asp.net/soever/archive/2007/05/04/factories-macaw-the-dotned-presentation-of-april-26-2007.aspx</link><pubDate>Thu, 03 May 2007 22:08:12 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:2489207</guid><dc:creator>svdoever</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=2489207</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2007/05/04/factories-macaw-the-dotned-presentation-of-april-26-2007.aspx#comments</comments><description>&lt;p&gt;On april 26, 2007 I gave a presentation at the Macaw headquarters in Schiphol-Rijk, The Netherlands on what we are doing with Software Factories at Macaw.&lt;/p&gt; &lt;p&gt;I promised the audience to publish some links to tools and information mentioned in the presentation. I can't upload the presentation itself because it was a real "look into the kitchen of..." session with information that we can't give away (yet). I promise to blog more on this in the future however.&lt;/p&gt; &lt;p&gt;Some initial posts on what we are working on:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Blog post by &lt;a href="http://www.macaw.nl/WebLogs/VincentH/xp/default.aspx" target="_blank"&gt;Vincent Hoogendoorn&lt;/a&gt;: &lt;a href="http://blogs.macaw.nl/blogs/general_development_solutions/archive/2006/04/14/Realizing_the_Software_Factories_Vision_for_a_Microsoft_Systems_Integrator.aspx" target="_blank"&gt;Realizing the Software Factories Vision for a Microsoft Systems Integrator&lt;/a&gt;&lt;/li&gt; &lt;li&gt;Blog post by Maarten Sikkema: &lt;a href="http://blogs.macaw.nl/blogs/corporate_marketing_directie_hr/archive/2007/01/17/660.aspx" target="_blank"&gt;De race naar Software Factories&lt;/a&gt; (in Dutch)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Tools we are using to realize our software factory vision:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=51a5c65b-c020-4e08-8ac0-3eb9c06996f4&amp;amp;DisplayLang=en" target="_blank"&gt;Visual studio SDK 4.0&lt;/a&gt; - Contains the DSL tools and everything to create visual studio extensions&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c0a394c0-5eeb-47c4-9f7b-71e51866a7ed&amp;amp;DisplayLang=en" target="_blank"&gt;Guidance Automation Extensions&lt;/a&gt; - Runtime needed to run GAT guidance packages&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e3d101db-6ee1-4ec5-884e-97b27e49eaae&amp;amp;DisplayLang=en" target="_blank"&gt;Guidance Automation Toolkit&lt;/a&gt; - Visual studio extension for development of guidance packages&lt;/li&gt; &lt;li&gt;&lt;a href="http://softwarefactoriestoolkit.net/" target="_blank"&gt;Clarius Software Factory Toolkit&lt;/a&gt;&amp;nbsp;- Additional tooling for developing GAT packages&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target="_blank"&gt;PowerShell&lt;/a&gt;&amp;nbsp;- The glue language we use extensively in our Solutions Factory. I have written thousands of lines of code in PowerShell, it rocks!&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;I hope you all had an informative session and got some "food for thought" ob what you could do within your organization. If you would like to leave a comment on what your impression of the presentation, please do so as a comment to this blog post, or send me a direct e-mail at &lt;a href="mailto:serge@macaw.nl"&gt;serge@macaw.nl&lt;/a&gt;!&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=2489207" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/soever/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category><category domain="http://weblogs.asp.net/soever/archive/tags/SoftwareFactories/default.aspx">SoftwareFactories</category></item><item><title>Consistent naming of PowerShell Cmdlets</title><link>http://weblogs.asp.net/soever/archive/2007/03/25/consistent-naming-of-powershell-cmdlets.aspx</link><pubDate>Sun, 25 Mar 2007 20:05:28 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:2092613</guid><dc:creator>svdoever</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/soever/rsscomments.aspx?PostID=2092613</wfw:commentRss><comments>http://weblogs.asp.net/soever/archive/2007/03/25/consistent-naming-of-powershell-cmdlets.aspx#comments</comments><description>&lt;p&gt;PowerShell has some simple guidelines in naming cmdlets so consistence is achieved in cmdlet names.&lt;/p&gt; &lt;p&gt;Some quotes from &lt;a href="http://msdn2.microsoft.com/en-us/library/ms714428.aspx" target="_blank"&gt;this page describing Cmdlet Verb Names&lt;/a&gt;:&lt;/p&gt; &lt;p&gt;&lt;em&gt;Windows PowerShell uses a verb-noun pair format for the names of cmdlets and their derived .NET classes. For example, the Get-Command cmdlet provided by Windows PowerShell is used to retrieve all commands registered in the Windows PowerShell shell. The verb part of the name identifies the action that the cmdlet performs. The noun part of the name identifies the entity on which the action is performed.&lt;/em&gt;&lt;/p&gt; &lt;p&gt;And&lt;/p&gt; &lt;p&gt;&lt;em&gt;The following list provides guidelines to consider when creating a verb-noun pair:&lt;/em&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt; &lt;p&gt;&lt;em&gt;When specifying the verb part of a name, it is strongly recommended to use one of the predefined verb names provided by Windows PowerShell. In doing so, you will ensure consistency between the cmdlets that you create, those provided by Windows PowerShell, and others.&lt;/em&gt;&lt;/p&gt; &lt;li&gt; &lt;p&gt;&lt;em&gt;To enforce consistency across cmdlets, do not use a synonym of an approved verb name.&lt;/em&gt;&lt;/p&gt; &lt;li&gt; &lt;p&gt;&lt;em&gt;Use only the present tense of a verb for a name. For example, use "get" instead of "getting". &lt;/em&gt;&lt;/p&gt; &lt;li&gt; &lt;p&gt;&lt;em&gt;Use a simple, singular noun in cmdlet naming. For example, use "Get-Record" instead of "Get-Records".&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;I wish I knew about this convention before writing loads of PowerShell code...&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=2092613" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/soever/archive/tags/PowerShell/default.aspx">PowerShell</category></item></channel></rss>