# Escape spaces in Invoke-IcingaCheckProcessCount

**URL:** <https://community.icinga.com/t/escape-spaces-in-invoke-icingacheckprocesscount/5753>\
**Category:** Service Monitoring\
**Created:** [October 10, 2020, 6:38am UTC](https://community.icinga.com/t/escape-spaces-in-invoke-icingacheckprocesscount/5753 "2020-10-10T06:38:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![0xliam](https://community.icinga.com/user_avatar/community.icinga.com/0xliam/32/1513_2.png) [@0xliam](https://community.icinga.com/u/0xliam)\
**Post date:** [October 10, 2020, 6:38am UTC](https://community.icinga.com/t/escape-spaces-in-invoke-icingacheckprocesscount/5753/1 "2020-10-10T06:38:56Z")

</div>

Hi there,

I am testing out Invoke-IcingaCheckProcessCount in a lab environment at home, and I am attempting to monitor if the ‘Plex Media Service’ process is running.

```
PS C:\Windows\system32> Get-Process -Name 'Plex Media Server'

Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
    837 338 117452 124536 15,743.31 5428 2 Plex Media Server

```

Running this manually in PS appears to work fine:

```
PS C:\Windows\system32> Invoke-IcingaCheckProcessCount -Warning '1:' -Critical '1:' -Process 'Plex Media Server'
[OK] Check package "Process Check"
| 'process_count_plex_media_server'=1;1:;1:
0

```

However when I use check command configured via Director, it appears it is treating the space between the process name as an escape character:

Plugin Output:

```
[CRITICAL] Check package "Process Check" - [CRITICAL] Process Count "Plex"
\_ [CRITICAL] Process Count "Plex": Value "0" is lower than threshold "1"

```

Executed command:

’`C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' '-C' 'try { Use-Icinga; } catch { Write-Output '\''The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details'\''; exit 3; }; Exit-IcingaPluginNotInstalled '\''Invoke-IcingaCheckProcessCount'\''; exit Invoke-IcingaCheckProcessCount' '-Warning' '1:' '-Critical' '1:' '-Process' 'Plex Media Server' '-Verbosity' '0'`

Custom Variables:

Custom Variables:

```
icingacheckprocesscount_array_process	Plex Media Server
icingacheckprocesscount_int32_verbosity	0
icingacheckprocesscount_object_critical	1:
icingacheckprocesscount_object_warning	1:
icingacheckprocesscount_switchparameter_noperfdata	false

```

Is there any way to escape the spaces? I’ve tried a few combinations but could not work it out.

---

<div class="post-metadata">

**Author:** ![Waldviertler](https://community.icinga.com/letter_avatar_proxy/v4/letter/w/91b2a8/32.png) [@Waldviertler](https://community.icinga.com/u/Waldviertler)\
**Post date:** [February 23, 2021, 4:40pm UTC](https://community.icinga.com/t/escape-spaces-in-invoke-icingacheckprocesscount/5753/2 "2021-02-23T16:40:00Z")

</div>

Hi,  
have you tried putting the process name into single quotes (‘Plex Media Server’) in the director array like you did in powershell? So the arguments should look like this:  
icingacheckprocesscount\_array\_process ‘Plex Media Server’

I had the same issue with $-signs and this worked for me.

---

<div class="post-metadata">

**Author:** ![0xliam](https://community.icinga.com/user_avatar/community.icinga.com/0xliam/32/1513_2.png) [@0xliam](https://community.icinga.com/u/0xliam)\
**Post date:** [February 23, 2021, 10:39pm UTC](https://community.icinga.com/t/escape-spaces-in-invoke-icingacheckprocesscount/5753/3 "2021-02-23T22:39:02Z")

</div>

I will give this a shot later tonight and report back 🙂

---

<div class="post-metadata">

**Author:** ![stevie-sy](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@stevie-sy](https://community.icinga.com/u/stevie-sy)\
**Post date:** [February 24, 2021, 7:31am UTC](https://community.icinga.com/t/escape-spaces-in-invoke-icingacheckprocesscount/5753/4 "2021-02-24T07:31:52Z")

</div>

Hi,

looks like the same problem like this: [Invoke-IcingaCheckService has problems with spaces in servicename · Issue #125 · Icinga/icinga-powershell-plugins · GitHub](https://github.com/Icinga/icinga-powershell-plugins/issues/125)
