cEPRSKillProcess.psm1

enum Ensure
{
   Absent
   Present
}

[DscResource()]
class cEPRSKillProcess
{
    [DscProperty(Key)] [String] $ProcessName
           

    [cEPRSKillProcess] Get()

    {

     $CheckProcess = Get-Process $this.ProcessName 

       $returnvalue = @{
            $this.ProcessName = $CheckProcess 
          }
       return $returnvalue
    }

    [bool] Test()
    
   {
      $CheckProcess = Get-Process $this.ProcessName
      if($CheckProcess)
      {
          return $false
      }
      else
      {
       
          return $true
       
      }
   }

    [void] Set()
    {
        try
        {
           (Get-Process $this.ProcessName).Kill()

        } 
        catch [System.Exception]
        {
           Write-Output $_.exception.message
        }
        finally
        {
           "Completed successfully"
        }
    
    }

}