Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't connect ExchangeServer2019-x64-CU13 #187

Open
joker-xiaoyan opened this issue Apr 9, 2024 · 2 comments
Open

can't connect ExchangeServer2019-x64-CU13 #187

joker-xiaoyan opened this issue Apr 9, 2024 · 2 comments

Comments

@joker-xiaoyan
Copy link

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
Copy link
Author

I really hope your reply. thanks

@jborean93
Copy link
Owner

Try

  • using the UPN username format test@DC.COM (or whatever the DNS domain name is)
  • set auth='kerberos' as Exchange only really supports Kerberos auth and not NTLM
  • what is add_parameter("") for, why is it adding an empty string here
  • check out ps.streams.error to see if there are any error records to explain why something might have failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants