Created
February 15, 2014 14:01
-
-
Save Nora-Ballard/9019696 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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