Make a PS script work on OPM

Make a PS script work on OPM

Hello, i have made a simple PS script to check the presence of crash dump files who are replicated on a DFS (and can sature it due to their size) and i want to implement it on OPM to directly have an alarm raised.

I have a dedicated service account to access to the path with RO rights.
I am not able to find what should i put on the "Command Line" and "Execution Directory" sections.

So, if a good soul could help me ;)

Set-Variable -Name "DFSPath"        -Value "\\myintranet\myapp\myfolder"

$LastHPROF = Get-ChildItem $DFSPath |
    Where-Object { $_.Name -match '.hprof' } |
        Sort-Object -Descending -Property LastWriteTime

$Date = (Get-Date).AddMinutes(-15)

If ($LastHPROF.LastWriteTime -gt $Date)
    {
    Write-Host "Error"
    } Else {
    Write-Host "Ok"
    Exit(0);
    }

Thanks in advance,
Charles-Edouard

                New to ADSelfService Plus?