question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Executing code on LOCAL exchange server

See original GitHub issue

Hi! I’m trying to implement following PS code with pypsrp for the local Exchange server:

$Session = (New-PSSession -configurationname Microsoft.Exchange -connectionURI http://exchange-srv.acme.com/PowerShell)
Import-PSSession $Session
Search-AdminAuditLog -StartDate '07-17-2019 09:00:00' -EndDate '07-18-2019 11:00:00'

PS code works fine, but not pypsrp version:

from pypsrp.powershell import PowerShell, RunspacePool
from pypsrp.wsman import WSMan

wsman = WSMan(server="exchange-srv.acme.com", port=5985, path="wsman", username="DOMAIN\\user", password="password", ssl=False, auth="kerberos", cert_validation=False)

with RunspacePool(wsman, configuration_name="Microsoft.Exchange") as pool:
    ps = PowerShell(pool)
    ps.add_script("Search-AdminAuditLog -StartDate '07-17-2019 09:00:00' -EndDate '07-18-2019 11:00:00'")
    output = ps.invoke()
    print output

The code above return resource exception:

pypsrp.exceptions.WSManFaultError: Received a WSManFault message. (Code: 2150858811, Machine: srv-scn-cas1.scnsoft.com, Reason: The WS-Management service cannot process the request. The resource URI (http://schemas.microsoft.com/powershell/Microsoft.Exchange) was not found in the WS-Management catalog. The catalog contains the metadata that describes resources, or logical endpoints.)

When changing “path” to “powershell”, I got 404:

HTTP Error 404. The requested resource is not found.

Can anyone help to identify the problem? Thank you in advance!

NOTE: issue duplicate is here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
goooroooXcommented, Aug 27, 2019

Thank you for assistance. I will comment on this issue if I will be able to handle this problem.

0reactions
goooroooXcommented, Jul 22, 2020

Thank you for information. Most likely I will not update my existing code, as it was tested and now working in production.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connect to Exchange servers using remote PowerShell
Connect to a remote Exchange server. On your local computer, open Windows PowerShell, and run the following command: PowerShell
Read more >
Microsoft Exchange – Code Execution - Penetration Testing Lab
Gaining access to the mailbox of a domain user can lead to execution of arbitrary code by utilising the credentials that have been...
Read more >
Microsoft Exchange Server Remote Code Execution - Truesec
There are open source tools that, given a target organization name, scrape LinkedIn and other social media sites to build a list of...
Read more >
Microsoft Exchange Server ChainedSerializationBinder ...
Microsoft Exchange Server ChainedSerializationBinder Remote Code Execution ... Exchange Server 2016 CU22 all prior to Mar22SU. Note that ...
Read more >
Microsoft Exchange Server - Wikipedia
Microsoft Exchange Server is a mail server and calendaring server developed by Microsoft. It runs exclusively on Windows Server operating systems.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found