Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save Nora-Ballard/9019696 to your computer and use it in GitHub Desktop.
function Get-TSMClientSchedule
{
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)
{
$Pattern = "^(?<LastCheckin>.{19})\sServer Window Start:\s*(?<ScheduleTime>\d\d:\d\d:\d\d) on (?<ScheduleDate>\d\d/\d\d/\d\d\d\d).*"
if (@(Select-String -Path $LogFile -Pattern '.{20}Server Window Start:')[-1].line -match $Pattern)
{
$Properties = @{
'ComputerName' = $ComputerName
'LastCheckin' = Get-Date $Matches.LastCheckin
'Schedule' = Get-Date $( $Matches.ScheduleDate + " " + $Matches.ScheduleTime )
}
Write-Output $(New-Object -TypeName PSObject -Property $Properties)
}
}
}
} #End PROCESS
} #End Function
#Get-TSMClientSchedule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment