jborean93/pypsrp

Enhancement: Make _utils.py: get_pwsh_script() a more generic method for any PS file

ReneH-cnx opened this issue · 1 comments

It seems like the function get_pwsh_script() in _utils.py would be really useful for any locally available PowerShell script files that needs to be executed on the remote machine.

Could it be added as a more generic method to one of the classes? I'm not quite sure which one would be best to add it to. Perhaps to PowerShell where add_script() can be found?

The util is mostly kept around for finding the ps1 files in the scripts folder. It uses the Python API to get the raw content of Python resources and isn't really designed for reading any file on the filesystem.

In reality it takes 2 lines to read any file locally on your file system

with open("/path/to/local/script.ps1", mode="r") as fd:
    script = fd.read()

Considering the simple nature and extreme flexibility you have by reading the script yourself I'm not sure I see the benefit of doing this inside pypsrp. Appreciate the suggestion but at this point this is not something I plan on implementing sorry.