HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/win_pwsh.cpython-310.pyc
o

�N�g��@s2ddlZddlZddlZddlmZddd�ZdS)�N)�CommandExecutionErrorcCs�t|t�r
d�tt|��}d|��vr|�d�}d|��vr#d|��}tjjj	|d|d�}d|vr4|d=|�
d	d
�rH|d	��d}t||d��d
|vsR|d
dkrXtd|d��|dd
krbd|d<ztj
jj|ddd�}W|Sty}td|d��w)a�
    Execute the powershell command and return the data as a dictionary

    .. versionadded:: 3006.9

    Args:

        cmd (str,list): The powershell command to run

        cwd (str): The current working directory

    Returns:
        dict: A dictionary containing the output of the powershell command

    Raises:
        CommandExecutionError:
            If an error is encountered or the command does not complete
            successfully
    � zconvertto-jsonz | ConvertTo-JsonZprogresspreferencez*$ProgressPreference = 'SilentlyContinue'; Z
powershell)�cmd�shell�cwd�pid�stderr�r)�info�retcodezIssue executing PowerShell cmd�stdoutz{}F)�strictzNo JSON results from PowerShell)�
isinstance�list�join�map�str�lower�salt�modulesZcmdmodZrun_all�get�
splitlinesr�utils�json�loads�
ValueError)rr�ret�error�r�G/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/win_pwsh.py�run_dicts,


��r )N)Zsalt.modules.cmdmodrZsalt.utils.jsonZsalt.utils.platformZsalt.exceptionsrr rrrr�<module>s