.. _powershell:

PowerShell
-----------

.. _25.4|VOSS-1470:


.. index:: voss-powershell

The ``voss-powershell`` service executes PowerShell scripts which communicate with the Microsoft cloud
(Teams & Exchange Online). It maintains multiple long-lived listener sessions per customer each with
its own persistent connection to Microsoft in order to avoid the slow connection process for every operation.

Running ``app status`` shows the service, for example:

::

   voss-powershell v25.4.0 (2026-04-15 11:50)
      |-voss-powershell       running

   
The VOSS platform CLI also provides a number of options from the ``powershell`` menu
to configure the server in accordance with requirements.

For command line syntax, refer to the *PowerShell commands reference* section below.


PowerShell memory requirements
.....................................................

The ``voss-powershell`` service will require an additional 8GB of RAM per application node
in order to take on the processing of scripts previously handled by a Windows server.
This should be a default starting point that will work for the majority of situations
but might be modified as needed based on unique usage patterns.

Cluster behaviour: A typical VOSS Core cluster has four application nodes, with transactions queued evenly across them.
In principle, PowerShell execution is distributed the same way because each app node runs its own
``voss-powershell`` instance and receives the work that the queue assigns to that node.
However, VOSS core is not aware of ``voss-powershell`` (it does not route based on PowerShell load or session count).
So although the queue spreads work evenly in the general case, it is possible for multiple heavy PowerShell scripts
to land on the same node. Sizing and concurrency limits are per node for this reason: each node must be able to
handle its share of load even if it occasionally gets more than an even split.


Settings Detail
.................

Only adjust if needed after consultation with support.

* Container memory limit: Set to match RAM you allocate to ``voss-powershell`` on that node. Default 10240 (10 GB).
* Global concurrency: How many total sessions can exist at once. Default 100 per service type.
* Per-customer concurrency: How many sessions each customer can have at the same time. Default 3 per service type.
* Session reaper (idle): How long a session can remain unused before being removed. Default 900 (15 min).
  Keep enabled for multi-tenant; 0 disables.
* Max session age: How long a session can exist before removed. Default 2700 (45 min); 0 = no cap.
* Per-listener memory (during script): Sessions will be immediately terminated causing an error if their memory
  use exceeds this value. Default 1024.
* Session eviction (after request): If the memory use of a session exceeds this value, it will be discarded after use.
  Default 500. The baseline for a session that is not doing anything is approx. 380MB so this should not be any lower
  than 500MB in order to make sure that sessions are not evicted every time they complete an operation; causing a
  slow reconnection on every request.



PowerShell commands reference
.............................

The commands and parameters available are listed below - as available in the CLI: 

::

   platform@VOSS:~$ powershell
   
   USAGE:
   ------
   powershell certificates list                              - List registered certificates                          
   powershell error-handler add <pattern>                    - Add handler with this pattern (defaults:              
                                                                 replace=true, retry=false). Use 'set <id>           
                                                                 <property> <value>' to adjust.                      
   powershell error-handler find <pattern>                   - Search handlers whose pattern contains this substring 
                                                                 (returns index and handler)                         
   powershell error-handler list                             - List error handlers (response includes 'handlers'     
                                                                 with index for set/remove)                          
   powershell error-handler refresh                          - Merge default error handlers into current config (add 
                                                                 new defaults, update existing)                      
   powershell error-handler remove <id>                      - Remove the handler at index (from list; use 'find     
                                                                 <pattern>' to get index)                            
   powershell error-handler remove pattern <pattern>         - Remove the handler with this exact pattern            
                                                                 (multi-word OK)                                     
   powershell error-handler set <id> <property> <value>      - Set one property on handler at index. Properties:     
                                                                 friendly, delay, replace, retry, error_code,        
                                                                 http_code. Value: true/false for replace/retry,     
                                                                 number for delay/http_code.                         
   powershell logging level                                  - Get current log level                                 
   powershell logging level set <level>                      - Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL) 
   powershell logs by execution <execution_id>               - Grep logs by execution ID and save to                 
                                                                 /opt/platform/admin/home/media (platform:platform)  
   powershell logs by session <session_id>                   - Grep logs by session ID and save to                   
                                                                 /opt/platform/admin/home/media (platform:platform)  
   powershell sessions delete <session_id>                   - Terminate one session by ID (session_id is globally   
                                                                 unique)                                             
   powershell sessions delete all <customer_key>             - Terminate all sessions for a customer (customer_key   
                                                                 can be multi-word)       
   powershell sessions list                                  - List active sessions (keyed by session_id); includes  
                                                                 idle_seconds and seconds_until_idle_reap for        
                                                                 available sessions                                  
   powershell sessions list <customer_key>                   - List active sessions for a customer (customer_key can 
                                                                 be multi-word); includes idle_seconds and           
                                                                 seconds_until_idle_reap when available              
   powershell settings concurrency                           - Get concurrency limits (global and per-customer per   
                                                                 service type). Effective after restart.             
   powershell settings concurrency global <service_type>     - Set global concurrency limit for service type (e.g.   
      <limit>                                                    msteams, msexchange). Takes effect after restart.   
   powershell settings concurrency per-customer              - Set per-customer concurrency limit for service type   
      <service_type> <limit>                                     (e.g. msteams 3, msexchange 2). Takes effect after  
                                                                 restart.                                            
   powershell settings container memory limit                - Get configured container memory limit (MB) and        
                                                                 minimum recommended (2048). Effective after restart.
   powershell settings container memory limit <mb>           - Set container memory limit (MB). Default 10240;       
                                                                 minimum recommended 2048 (~380 MB per listener).    
                                                                 Takes effect after service restart.                 
   powershell settings memory                                - List persistent memory settings                       
                                                                 (max_session_process_rss_mb,                        
                                                                 listener_memory_limit_mb,                           
                                                                 listener_memory_check_interval_seconds,             
                                                                 max_response_size_bytes)                            
   powershell settings memory <key>                          - Get one memory setting. Keys:                         
                                                                 max_session_process_rss_mb,                         
                                                                 listener_memory_limit_mb,                           
                                                                 listener_memory_check_interval_seconds,             
                                                                 max_response_size_bytes (or aliases                 
                                                                 max_session_mem_usage, listener_limit_mb,           
                                                                 listener_check_interval, max_response_size)         
   powershell settings memory <key> <value>                  - Set one memory setting. Keys:                         
                                                                 max_session_process_rss_mb (or                      
                                                                 max_session_mem_usage), listener_memory_limit_mb    
                                                                 (or listener_limit_mb),                             
                                                                 listener_memory_check_interval_seconds (or          
                                                                 listener_check_interval), max_response_size_bytes   
                                                                 (or max_response_size). Takes effect after restart. 
   powershell settings session                               - Get session / idle-reaper settings                    
                                                                 (listener_idle_reap_seconds,                        
                                                                 listener_idle_reap_interval_seconds,                
                                                                 max_session_age_seconds). Takes effect immediately  
                                                                 when updated.                                       
   powershell settings session <key> <value>                 - Set one session setting. Keys:                        
                                                                 listener_idle_reap_seconds (0=disable reaper),      
                                                                 listener_idle_reap_interval_seconds,                
                                                                 max_session_age_seconds (0=no cap). Takes effect    
                                                                 immediately.                                        
   powershell storage files                                  - List files currently in request file storage          
   



.. rubric:: Related topics

* 
  .. raw:: latex

     PowerShell proxy server in the UC Automation Guide

  .. raw:: html
  
     <a href="../pshell-proxy-setup-script.html">PowerShell proxy server</a> 

