Executing code on LOCAL exchange server
See original GitHub issueHi! 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:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
Thank you for assistance. I will comment on this issue if I will be able to handle this problem.
Thank you for information. Most likely I will not update my existing code, as it was tested and now working in production.