Thursday, August 29, 2013

PowerShell "Tail" function

I was trying to write this myself a few weeks ago and was tearing my hair out.  Well, that was mostly because I was trying to write a tail last 10 type function, but I definatly have to play with this little goody from John Murphy (http://www.jbmurphy.com/)

function JBM-AD-GetDHCPLogs
{
 PARAM($ServerName="dhcpServerName")
 $FileName="DhcpSrvLog-$(get-date -format ddd).log"
 $PATH="\\$ServerName\c$\Windows\System32\dhcp\$FileName"
 Get-Content $path –Wait
}

No comments:

Post a Comment