Skip to content

Instantly share code, notes, and snippets.

@Nora-Ballard
Created February 15, 2014 14:00
Show Gist options
  • Select an option

  • Save Nora-Ballard/9019690 to your computer and use it in GitHub Desktop.

Select an option

Save Nora-Ballard/9019690 to your computer and use it in GitHub Desktop.
function Get-TSMClientEvents
{
Param(
[Parameter(Mandatory=$true, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$true)]
$ComputerName
)
PROCESS
{
if ($ComputerName -is [Array])
{
$ComputerName | ForEach-Object { Get-TSMSchedule -ComputerName $_ }
}
else
{
$LogFile = Join-Path "\\$ComputerName\" 'C$\Program Files\Tivoli\TSM\baclient\dsmsched.log'
Write-Debug $LogFile
if (test-path $LogFile)
{
Get-Content $LogFile | ForEach-Object {
$Pattern = "^(?<Date>.{19})\s(?<EventCode>.{8})\s(?<Event>[^']*)(?<Path>'.*'):\s*(?<Description>.*)"
if ($_ -match $Pattern )
{
$Properties = @{
'ComputerName' = $ComputerName
'Date' = Get-Date $Matches.Date
'EventCode' = $Matches.EventCode
'Event' = $Matches.Event
'Path' = $Matches.Path
'Description' = $Matches.Description
}
Write-Output $(New-Object -TypeName PSObject -Property $Properties)
}
}
}
}
} #End PROCESS
} #End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment