Sample for getting Run History by providing details. Very useful for seeing the results of a specific MA, profile, etc.

This sample also shows how to add a calculated property by using Select-Object with a custom expression.

### Load the FIM Sync PowerShell Module
Import-Module .\FimSyncPowerShellModule.psm1

### Get the Run History for:
### MA:          FIM 
### Run Profile: Export
### Since:       3/1
### Computer:    MyFavouriteSyncServer
Get-MIIS_RunHistory -MaName FIM -StartedAfter 8/14 -RunProfile Export -ComputerName MyFavouriteSyncServer | 

### Add a Property for 'Duration'
Select-Object -Property @(
    'MaName'
    'RunProfile'
    'RunStartTime'
    @{
        Name='Duration'; 
        Expression = 
        {
            ([datetime]$_.RunEndTime - [datetime]$_.RunStartTime)
        }
     }
) | 

### Sort by RunStartTime
Sort-Object RunStartTime |

### Output as a Table
Format-Table -AutoSize

Results

MaName RunProfile RunStartTime            Duration        
------ ---------- ------------            --------        
FIM    Export     2014-03-01 09:57:17.087 00:25:21.4030000
FIM    Export     2014-03-01 12:05:41.977 00:03:37.1200000
FIM    Export     2014-03-01 20:57:08.723 00:13:31.7000000
FIM    Export     2014-03-02 04:53:48.250 00:08:16.1170000
FIM    Export     2014-03-02 09:17:32.067 00:10:17.3100000
FIM    Export     2014-03-02 11:52:55.197 00:03:21.8730000
FIM    Export     2014-03-02 15:02:12.083 00:06:24.8940000
FIM    Export     2014-03-17 23:36:44.943 16:04:48.2470000

Last edited Mar 25, 2014 at 4:44 AM by CraigMartin, version 1

Comments

No comments yet.