Running WindowsProcess

Welcome Forums DSC (Desired State Configuration) Running WindowsProcess

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
3 years, 10 months ago.

  • Author
    Posts
  • #22171

    Participant
    Points: 0
    Rank: Member

    Hi All,

    I am working on converting a powershell script to DSC Configuration to run a process.

    Script :

    $si = new-object System.Diagnostics.ProcessStartInfo
    $si.fileName = "C:\Windows\System32\wevtutil.exe"
    $si.Arguments= ' sl Microsoft-IIS-Configuration/Operational /e:true'
    $si.windowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden

    $process = [System.Diagnostics.Process]::Start[$si]

    DSC Configuration block :

    WindowsProcess wevutilprocess
    {
    Ensure = "Present"
    Path = "C:\Windows\System32\wevtutil.exe"
    Arguments = ' sl Microsoft-IIS-Configuration/Operational /e:true'
    StandardErrorPath = "C:\log.txt"
    }

    Below is the Error I am getting :

    PowerShell provider MSFT_ProcessResource failed to execute Set-TargetResource functionality with error message: Failure starting process matching path
    'C:\Windows\System32\wevtutil.exe'. Message: "Failed to wait for processes to start".
    + CategoryInfo : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName : localhost

    Please post your thoughts.

    Thanks,
    Aravinda

  • #22223

    Keymaster
    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    That means it was unable to find the executable at the path you specified, or the process did not start in time, or did not start at all.

    It's possible that the process you are trying to start doesn't like being run with no security context, which is how DSC configurations run.

The topic ‘Running WindowsProcess’ is closed to new replies.