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)
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
get_mailbox_info()
terminal return :Received a WSManFault message. (No details returned by the server)