<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://powershelllive.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">reference</title><subtitle type="html" /><id>http://powershelllive.com/blogs/reference/atom.aspx</id><link rel="alternate" type="text/html" href="http://powershelllive.com/blogs/reference/default.aspx" /><link rel="self" type="application/atom+xml" href="http://powershelllive.com/blogs/reference/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.61129.2">Community Server</generator><updated>2007-03-27T15:16:00Z</updated><entry><title>get-content</title><link rel="alternate" type="text/html" href="http://powershelllive.com/blogs/reference/archive/2007/03/27/get-content.aspx" /><id>http://powershelllive.com/blogs/reference/archive/2007/03/27/get-content.aspx</id><published>2007-03-27T13:16:00Z</published><updated>2007-03-27T13:16:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;I style="mso-bidi-font-style:normal;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;Aliases:&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt; gc, cat, type&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;I style="mso-bidi-font-style:normal;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;Purpose:&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt; Retrieving item content&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;B style="mso-bidi-font-weight:normal;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Examples:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Getting all content in a text file by specifying the files path:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;get-content c:\mytext.txt&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;${c:\mytext.txt}&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Note: &lt;STRONG&gt;$ { }&lt;/STRONG&gt; main purpose is to allow&amp;nbsp;access to identifier names that would otherwise cause a conflict because of special characters. That's why inside the curly brackets only literals are allowed which are treated as-is. You &lt;EM&gt;must&lt;/EM&gt; type in the text exactly the&amp;nbsp;way it is going to be used. You may not quote it, and you may not use variables instead because in these cases, get-content would actually look for a quoted path (which does not exist) or a path named like the variable you used (which also does not exist). That's why &lt;STRONG&gt;$ {&amp;nbsp;}&lt;/STRONG&gt; really is no alternative to &lt;EM&gt;get-content&lt;/EM&gt; in most cases.&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Getting the content of a file from a FileInfo object:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;$file = Dir c:\mytext.txt&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;$file | get-content&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Reading only the first 10 lines of a text based file:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;get-content c:\mytext.txt -totalcount 10&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Getting line 5 from a text based file:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;$content = get-content c:\mytext.txt&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;$content[4]&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Or:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;(get-content c:\mytext.txt)[4]&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Getting lines 4 to 7:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;(get-content c:\mytext.txt)[3..6]&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Getting the last 3 lines from a text based file:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;(get-content c:\mytext.txt)[((get-content c:\mytext.txt).length-3)..((get-content c:\mytext.txt).length)]&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Processing content of a text based file line by line:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;get-content c:\mytext.txt | foreach-object { "Processing: " + $_ }&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;get-content c:\mytext.txt |&amp;nbsp;% { "Processing: " + $_ }&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;get-content c:\mytext.txt | %{ $a++; "Zeile $a = $_"}&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Retrieving all lines of a text based file that contain a special keyword:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;get-content $env:windir\windowsupdate.log | select-string "Agent"&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;get-content $env:windir\windowsupdate.log | select-string "`tAgent`t"&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Reading in a text based file with server names&amp;nbsp;or IP&amp;nbsp;addresses and use that to connect to and retrieve remote information:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:'Courier New';mso-fareast-language:DE;"&gt;Get-Content "servers.txt" |&amp;nbsp;%{ get-wmiobject win32_operatingsystem -computername $_ } |&amp;nbsp;export-csv "result.csv" –notypeinformation&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Determine number of lines in a text document:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;get-content c:\mytext.txt |&amp;nbsp;measure-object&amp;nbsp;&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;(get-content c:\mytext.txt |&amp;nbsp;measure-object&amp;nbsp;).Count&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;(get-content c:\mytext.txt).Length&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Reading binary content:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:'Times New Roman';mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;get-content $env:windir\explorer.exe -encoding byte&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Reading binary content in chunks of 10 bytes:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:'Times New Roman';mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;get-content $env:windir\explorer.exe -encoding byte -readcount 10 | %&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:'Times New Roman';mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:'Times New Roman';mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;$line = $_&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:'Times New Roman';mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;$text = $line | %{ " " + ("{0:x}" -f $_).PadLeft(2,"0")}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:'Times New Roman';mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;"$text"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:'Times New Roman';mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Reading 4 bytes from a specific position:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;$file = "$env:windir\explorer.exe"&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;Get-Content -encoding byte&amp;nbsp;$file -read 4 -total 4&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;Read the code of a function:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;Dir function:&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;Get-Content function:more&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;$function:more&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;Get-Content function:Z:&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-ansi-language:EN-AU;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;FONT face=Calibri&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;$function:Z:&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;LINE-HEIGHT:normal;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;"&gt;&lt;SPAN style="FONT-SIZE:12pt;mso-fareast-font-family:'Times New Roman';mso-bidi-font-family:Arial;mso-fareast-language:DE;"&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0cm 0cm 10pt;"&gt;&lt;SPAN style="FONT-SIZE:12pt;LINE-HEIGHT:115%;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://powershelllive.com/aggbug.aspx?PostID=43" width="1" height="1"&gt;</content><author><name>tobias</name><uri>http://powershelllive.com/members/tobias.aspx</uri></author><category term="get-content" scheme="http://powershelllive.com/blogs/reference/archive/tags/get-content/default.aspx" /></entry></feed>