Have script

$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
$endTimeinUTC = Get-SPOTenantLogLastAvailableTimeInUtc
$startTimeinUTC = $endTimeinUTC.AddDays -14
$tenantlogs = Get-SPOTenantLogEntry -StartTimeinUtc $startTimeinUTC -EndTimeinUTC $endTimeinUTC -CorrelationId e2c3b19d-a0ff-3000-9581-1c7740558593

Make it using https://technet.microsoft.com/pl-pl/library/fp161369.aspx

But got error "Method invocation failed because [System.Management.Automation.PSMethod] does not contain a method named 'op_Subtraction'."

Any ideas? Im connecting to sharepoint online


Looks like the subtraction at start time is not working.please replace this line

$startTimeinUTC = $endTimeinUTC.AddDays -14

With this line

$startTimeinUTC = $endTimeinUTC.AddDays (-14)
| improve this answer | |
  • Then i got this error: At C:\uninstall.ps1:6 char:41 + $startTimeinUTC = $endTimeinUTC.AddDays (-14) + ~ Unexpected token '(' in expression or statement. + CategoryInfo : ParserError: (:) [], ParseException + FullyQualifiedErrorId : UnexpectedToken this is why I write -14 not (-14) – Rhonin Oct 28 '16 at 9:28
  • Adddays is method so you have to put in (), are you getting any value for $endtimeinutc? – Waqas Sarwar MVP Oct 28 '16 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.