<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwizguide.com/rss_namespace/">
 <channel>
  <title>ScriptingAnswers.com Forums</title>
  <link>http://www.scriptinganswers.com/forum2/</link>
  <description>This is an XML content feed of; ScriptingAnswers.com Forums : Last 10 Posts</description>
  <pubDate>Thu, 11 Mar 2010 18:33:00 +0000</pubDate>
  <lastBuildDate>Thu, 11 Mar 2010 11:58:48 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.0</generator>
  <ttl>30</ttl>
  <WebWizForums:feedURL>www.scriptinganswers.com/forum2/RSS_topic_feed.asp</WebWizForums:feedURL>
  <image>
   <title>ScriptingAnswers.com Forums</title>
   <url>http://www.scriptinganswers.com/forum2/forum_images/web_wiz_forums.png</url>
   <link>http://www.scriptinganswers.com/forum2/</link>
  </image>
  <item>
   <title>PowerShell Development : GUI &#083;cripting</title>
   <link>http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3700&amp;PID=22115#22115</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.scriptinganswers.com/forum2/member_profile.asp?PF=2491" rel="nofollow">jvierra</a><br /><strong>Subject:</strong> GUI &#083;cripting<br /><strong>Posted:</strong> 11 Mar 2010 at 11:58<br /><br />Hello sleezer - youare posting in the wrong forum but that's ok.<DIV>&nbsp;</DIV><DIV>This forum in for compiled extensions to POwerShell.&nbsp; The parent forum is for generic PoSH questions.</DIV><DIV>&nbsp;</DIV><DIV>Do you know how to get this information in PowerShell and the command line?&nbsp; </DIV><DIV>&nbsp;</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><DIV><strong>$drives = get-psdrive -psprovider FileSystem | select root</strong></DIV><DIV>&nbsp;</DIV><DIV>For file list use:</DIV><DIV><strong>$drives|select @{Name="Path";Expression={$_.root}}| Get-ChildItem</strong></DIV><DIV></pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>Add these items one at a time to your combobox or listbox.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Thu, 11 Mar 2010 11:58:48 +0000</pubDate>
   <guid isPermaLink="true">http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3700&amp;PID=22115#22115</guid>
  </item> 
  <item>
   <title>Windows PowerShell : Script File Full Path</title>
   <link>http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3697&amp;PID=22114#22114</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.scriptinganswers.com/forum2/member_profile.asp?PF=2491" rel="nofollow">jvierra</a><br /><strong>Subject:</strong> Script File Full Path<br /><strong>Posted:</strong> 11 Mar 2010 at 11:37<br /><br />It absolutely d&#140;s work. <DIV>&nbsp;</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><DIV>File one is(first.ps1):</DIV><DIV><strong>write-host "Hello from FIrst.ps1 $($MyInvocation.MyCommand.Definition)" -fore white -back green</strong></DIV><DIV><strong>.\test.ps1</strong><BR></DIV><DIV><strong></strong></DIV><DIV><strong></strong>&nbsp;</DIV><DIV>Test.ps1 is</DIV><DIV><strong>write-host " Hello from $($MyInvocation.MyCommand.Definition)" -foregroundcolor DarkGreen -backgroundcolor white</strong><BR></DIV><DIV><strong></strong></DIV><DIV>&nbsp;</DIV><DIV></pre></td></tr></table></DIV><DIV>Output is:<BR></DIV><DIV><strong></strong>&nbsp;</DIV><DIV>&nbsp;<img src="http://www.&#115;criptinganswers.com/forum2/uploads/2491/screen.JPG" height="109" width="457" border="0" /></DIV><DIV><strong></strong>&nbsp;</DIV>]]>
   </description>
   <pubDate>Thu, 11 Mar 2010 11:37:35 +0000</pubDate>
   <guid isPermaLink="true">http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3697&amp;PID=22114#22114</guid>
  </item> 
  <item>
   <title>Windows PowerShell : Strings aren&#039;t the object...</title>
   <link>http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3701&amp;PID=22113#22113</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.scriptinganswers.com/forum2/member_profile.asp?PF=2491" rel="nofollow">jvierra</a><br /><strong>Subject:</strong> Strings aren&#039;t the object...<br /><strong>Posted:</strong> 11 Mar 2010 at 11:22<br /><br />Look into using <strong>Send-MailMessage&nbsp; </strong>which is one of the built in CmdLets.<DIV>&nbsp;</DIV><DIV>Type "<strong>help send-mailmessage -full</strong>"</DIV><DIV>&nbsp;</DIV><DIV>Much of your example can be updated due to PowerShell V2 features.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Thu, 11 Mar 2010 11:22:41 +0000</pubDate>
   <guid isPermaLink="true">http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3701&amp;PID=22113#22113</guid>
  </item> 
  <item>
   <title>Windows PowerShell : Strings aren&#039;t the object...</title>
   <link>http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3701&amp;PID=22112#22112</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.scriptinganswers.com/forum2/member_profile.asp?PF=33035" rel="nofollow">cruisader03</a><br /><strong>Subject:</strong> Strings aren&#039;t the object...<br /><strong>Posted:</strong> 11 Mar 2010 at 11:18<br /><br />Use the -InstanceID parameter for Get-EventLog<br><br><font face="Courier New, Courier, mono">$events = Get-EventLog Application -newest 2048 -</font>InstanceID $searchStr <font face="Courier New, Courier, mono">| Where-Object { isWithin -1 $_.TimeWritten }<br><br>Also, check using the -After &lt;DateTime&gt; -Before &lt;DateTime&gt;<br></font>]]>
   </description>
   <pubDate>Thu, 11 Mar 2010 11:18:08 +0000</pubDate>
   <guid isPermaLink="true">http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3701&amp;PID=22112#22112</guid>
  </item> 
  <item>
   <title>Windows PowerShell : Strings aren&#039;t the object...</title>
   <link>http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3701&amp;PID=22111#22111</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.scriptinganswers.com/forum2/member_profile.asp?PF=24094" rel="nofollow">khauer</a><br /><strong>Subject:</strong> Strings aren&#039;t the object...<br /><strong>Posted:</strong> 11 Mar 2010 at 10:20<br /><br /><FONT size=2 face="Arial, Helvetica, sans-serif">So, you'll have to forgive me... I've just gotten so used to VBScript. PowerShell is something I'm very interested in, but I haven't *quite* been able to make the complete adjustment to it, especially when scripting with it. (One-liners are a different story, I love its power!)</FONT><DIV>&nbsp;</DIV><DIV><FONT size=2 face="Arial, Helvetica, sans-serif">So I wrote the following script (with thanks to&nbsp;Mr. Snover for his "inWithin" function):</FONT></DIV><DIV>&nbsp;</DIV><DIV><FONT face="Courier New, Courier, mono"># FileName: Search-ApplicationLog.PS1</FONT></DIV><DIV><FONT face="Courier New, Courier, mono"># Script Name:&nbsp;Search-ApplicationLog<BR># Created:&nbsp;&nbsp;&nbsp;2010.03.10<BR># Author:&nbsp;&nbsp;&nbsp;K.Hauer</FONT></DIV><DIV><FONT face="Courier New, Courier, mono"># ------------------------------------------------------------------------------<BR># Purpose:<BR># This script will search a limited number of the newest entries in the<BR># application log, filter out only those that were written in the last 24 hours<BR># and contain a specific Event ID. If it finds the particular Event ID, it will<BR># then send an email to a specified email address to notify of the event.<BR># ------------------------------------------------------------------------------</FONT></DIV><DIV><FONT face="Courier New, Courier, mono"># ------------------------------------------------------------------------------<BR># FUNCTION LISTINGS<BR># ------------------------------------------------------------------------------<BR># Function:&nbsp;isWithin<BR># Created:&nbsp;&nbsp;2006.09.06<BR># Author:&nbsp;&nbsp;Jeffrey Snover<BR># Arguments:&nbsp;-&lt;days&gt;<BR># ------------------------------------------------------------------------------<BR># Purpose:<BR># Go back x number of days back from "now". (The argument should be a negative<BR># number.)<BR># ------------------------------------------------------------------------------</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">Function isWithin(&#091;int&#093;$days, &#091;datetime&#093;$Date)<BR>{<BR>&nbsp;&#091;DateTime&#093;::Now.AddDays($days).Date -le $Date.Date<BR>}</FONT></DIV><DIV><FONT face="Courier New, Courier, mono"># ==============================================================================<BR># SCRIPT BODY<BR># ==============================================================================</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">$tempFile = &#091;System.IO.Path&#093;::GetTempFileName() # Creates a randomly named temp file<BR>$searchStr = "9688" # Variable to hold the value to be searched for</FONT></DIV><DIV><FONT face="Courier New, Courier, mono"># Command to parse the log file<BR>Get-EventLog Application -newest 2048 | Where-Object { isWithin -1 $_.TimeWritten } | Where-Object { $_.EventID -match $searchStr } | Out-File $tempFile</FONT></DIV><DIV><FONT face="Courier New, Courier, mono"># Variable to hold the value returned after the temp file is searched for the value in $searchStr<BR>$selection = Select-String -pattern $searchStr -path $tempFile</FONT></DIV><DIV><FONT face="Courier New, Courier, mono"># If the $selection variable is empty, the script will exit, otherwise it will send the notification email<BR>If($selection -eq $null)<BR>{<BR>&nbsp;Remove-Item -Force $tempFile # Clean up action<BR>&nbsp;Exit<BR>}<BR>Else<BR>{<BR>&nbsp;$email = New-Object System.Net.Mail.MailMessage<BR>&nbsp;$to = "</FONT><a href="mailto:recipient@domain.com" target="_blank"><FONT face="Courier New, Courier, mono">recipient@domain.com</FONT></A><FONT face="Courier New, Courier, mono">" # Additional email addresses can be added, separated by commas and inside their own double quotes</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">&nbsp;Foreach($mailTo in $to)<BR>&nbsp;{<BR>&nbsp;&nbsp;$email.To.Add($mailTo)<BR>&nbsp;}</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">&nbsp;$email.From = "</FONT><a href="mailto:sender@domain.com" target="_blank"><FONT face="Courier New, Courier, mono">sender@domain.com</FONT></A><FONT face="Courier New, Courier, mono">"<BR>&nbsp;$email.Subject = "Custom subject line"<BR>&nbsp;$email.Body = "Custom message body"</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">&nbsp;$client = New-Object System.Net.Mail.SmtpClient myMailServer.domain.com # This the FQDN of the *sending* mail server<BR>&nbsp;$client.UseDefaultCredentials = $true<BR>&nbsp;$client.Send($email)<BR>}</FONT></DIV><DIV><FONT face="Courier New, Courier, mono">Remove-Item -Force $tempFile # Clean up action</FONT></DIV><DIV><FONT face="Courier New, Courier, mono"># ==============================================================================<BR># END OF SCRIPT: Search-ApplicationLog.PS1<BR># ==============================================================================</FONT></DIV><DIV><FONT face="Courier New"></FONT>&nbsp;</DIV><DIV><FONT size=2 face="Arial, Helvetica, sans-serif">So here I am, using PowerShell, but searching through a string to find a pattern. I *know* there must be a better, more desirable way to simply look at the log entries as they're retrieved and just evaluate based on the EventID property, but for the life of me I couldn't get it to work. Whenever I stored the "Get-EventLog" output into a variable, the variable contained quite different data from what I expected.</FONT></DIV><DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV><DIV><FONT size=2 face=Arial>So, this way works, but would someone be so kind as to show me how I might do it with objects rather than strings?</FONT></DIV><DIV><FONT size=2 face=Arial></FONT>&nbsp;</DIV><DIV><FONT size=2 face=Arial>Thank you in advance!</FONT></DIV>]]>
   </description>
   <pubDate>Thu, 11 Mar 2010 10:20:42 +0000</pubDate>
   <guid isPermaLink="true">http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3701&amp;PID=22111#22111</guid>
  </item> 
  <item>
   <title>Windows PowerShell : Script File Full Path</title>
   <link>http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3697&amp;PID=22110#22110</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.scriptinganswers.com/forum2/member_profile.asp?PF=33035" rel="nofollow">cruisader03</a><br /><strong>Subject:</strong> Script File Full Path<br /><strong>Posted:</strong> 11 Mar 2010 at 08:22<br /><br />explain more about how what exactly you are trying to do please]]>
   </description>
   <pubDate>Thu, 11 Mar 2010 08:22:38 +0000</pubDate>
   <guid isPermaLink="true">http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3697&amp;PID=22110#22110</guid>
  </item> 
  <item>
   <title>VBScript : Moving a computer from an unknown OU to a known OU</title>
   <link>http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3695&amp;PID=22109#22109</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.scriptinganswers.com/forum2/member_profile.asp?PF=2491" rel="nofollow">jvierra</a><br /><strong>Subject:</strong> Moving a computer from an unknown OU to a known OU<br /><strong>Posted:</strong> 11 Mar 2010 at 07:29<br /><br />You can&nbsp; run a post-staging script that runs AFTER the machine is joined to the domain.&nbsp; THis willguarantee that teh domain canbve contacted.&nbsp; YOu error says youare running the script on a machine that is not "pointed" at the domain.<DIV></DIV>]]>
   </description>
   <pubDate>Thu, 11 Mar 2010 07:29:22 +0000</pubDate>
   <guid isPermaLink="true">http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3695&amp;PID=22109#22109</guid>
  </item> 
  <item>
   <title>PowerShell Development : GUI &#083;cripting</title>
   <link>http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3700&amp;PID=22108#22108</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.scriptinganswers.com/forum2/member_profile.asp?PF=32826" rel="nofollow">sl33zer</a><br /><strong>Subject:</strong> GUI &#083;cripting<br /><strong>Posted:</strong> 11 Mar 2010 at 07:04<br /><br /><font color="#000000">Hello</font><font color="#000000"><span style="color: rgb31, 73, 125;"><o:p></o:p></span><br><br>I want to show in a combobox all local and network drives, when I welect one from the combobox, then all directories and files from that drive should be shown in a listbox<br><br>can&nbsp;</font> anybody help me?<br><br>many thanks<br>]]>
   </description>
   <pubDate>Thu, 11 Mar 2010 07:04:05 +0000</pubDate>
   <guid isPermaLink="true">http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3700&amp;PID=22108#22108</guid>
  </item> 
  <item>
   <title>VBScript : Moving a computer from an unknown OU to a known OU</title>
   <link>http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3695&amp;PID=22107#22107</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.scriptinganswers.com/forum2/member_profile.asp?PF=33090" rel="nofollow">hobgoblin11</a><br /><strong>Subject:</strong> Moving a computer from an unknown OU to a known OU<br /><strong>Posted:</strong> 11 Mar 2010 at 07:03<br /><br />Unfortunately cs.ini processing wont move an existing asset to a staging OU.. only a new asset.]]>
   </description>
   <pubDate>Thu, 11 Mar 2010 07:03:24 +0000</pubDate>
   <guid isPermaLink="true">http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3695&amp;PID=22107#22107</guid>
  </item> 
  <item>
   <title>Windows PowerShell : Script File Full Path</title>
   <link>http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3697&amp;PID=22106#22106</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.scriptinganswers.com/forum2/member_profile.asp?PF=33113" rel="nofollow">skaa</a><br /><strong>Subject:</strong> Script File Full Path<br /><strong>Posted:</strong> 11 Mar 2010 at 06:09<br /><br />Thank you very much! Unfortunately, it d&#140;s not work if I run this script file from another script file...]]>
   </description>
   <pubDate>Thu, 11 Mar 2010 06:09:20 +0000</pubDate>
   <guid isPermaLink="true">http://www.scriptinganswers.com/forum2/forum_posts.asp?TID=3697&amp;PID=22106#22106</guid>
  </item> 
 </channel>
</rss>