jborean93 / pypsrp

PowerShell Remoting Protocol for Python
MIT License
324 stars 49 forks source link

can't connect ExchangeServer2019-x64-CU13 #187

Open joker-xiaoyan opened 5 months ago

joker-xiaoyan commented 5 months ago

I can't use pypsrp to connect Exchange Server by thes codes: from pypsrp.powershell import PowerShell, RunspacePool from pypsrp.wsman import WSMan def get_mailbox_info(): host = "win-at34242t.dc.com" username = username password = password

# 创建 WSMan 对象
wsman = WSMan(
    server = host,
    username="dc\\test",
    password="123456Test!",
    path= "PowerShell",
    ssl=False,
    port=80,
    cert_validation=False
)
# 创建 RunspacePool 对象
pool = RunspacePool(wsman, configuration_name="Microsoft.Exchange")

# 创建 PowerShell 对象
ps = PowerShell(pool)
print("创建Powershell对象成功!")
try:
    ps.add_cmdlet("Get-Mailbox").add_parameter("")
    output = ps.invoke()
    print("[+] OUTPUT:\n%s" % "\n".join([str(s) for s in output]))
except Exception as e:
        print(f"wrong:{e}")

    finally:
        pool.close()

get_mailbox_info()

terminal return :Received a WSManFault message. (No details returned by the server)

joker-xiaoyan commented 5 months ago

I really hope your reply. thanks

jborean93 commented 5 months ago

Try