<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://powershell.com/cs/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>Remoting</title><link>http://powershell.com/cs/forums/107.aspx</link><description>Using PowerShell to remotely administer your Windows environment.</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>Re: pass local script to remote script block</title><link>http://powershell.com/cs/forums/thread/8767.aspx</link><pubDate>Tue, 21 Dec 2010 15:16:06 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:8767</guid><dc:creator>scottw512</dc:creator><slash:comments>0</slash:comments><comments>http://powershell.com/cs/forums/thread/8767.aspx</comments><wfw:commentRss>http://powershell.com/cs/forums/commentrss.aspx?SectionID=238&amp;PostID=8767</wfw:commentRss><description>&lt;p&gt;I finally figured this out. The Get-Content cmdlet was stripping out line breaks, and the parameter cast looks like it was messing something up. Here&amp;#39;s the fixed code&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;$scr = [io.file]::ReadAllText(&amp;quot;function_lib.ps1&amp;quot;)&lt;/p&gt;
&lt;p&gt;invoke-command -ComputerName remote-computer -ArgumentList $scr -ScriptBlock {&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; param ($scr)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; invoke-expression -Command $scr&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; use-function-from-lib -parm1 &amp;quot;parm1&amp;quot;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>pass local script to remote script block</title><link>http://powershell.com/cs/forums/thread/8756.aspx</link><pubDate>Mon, 20 Dec 2010 22:24:47 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:8756</guid><dc:creator>scottw512</dc:creator><slash:comments>0</slash:comments><comments>http://powershell.com/cs/forums/thread/8756.aspx</comments><wfw:commentRss>http://powershell.com/cs/forums/commentrss.aspx?SectionID=238&amp;PostID=8756</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using invoke-command to run script code on a remote computer. I have a file with a library of functions I&amp;#39;d like to pass into the remotely executed script, but I&amp;#39;m only getting the first line. The problem is something to do with my ArgumentList but I can&amp;#39;t get one that works. Here&amp;#39;s what I have&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;$scr = Get-Content &amp;quot;.\function_lib.ps1&amp;quot;&lt;/p&gt;
&lt;p&gt;invoke-command -ComputerName remote-computer -ArgumentList $scr -ScriptBlock {&lt;/p&gt;
&lt;p&gt;param ([string]$scr)&lt;/p&gt;
&lt;p&gt;invoke-expression -Command $scr&lt;/p&gt;
&lt;p&gt;use-function-from-lib -parm1 &amp;quot;parm1&amp;quot;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If I write the contents of $scr to a file, all I get is the first line. How can I pass the string representation of the function library to the remote script?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Scott&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>