Somewhat new to exchange shell. I'm wanting to run a query to return exchange resource/equipment mailboxes that matches certain conditions
Get-mailbox -RecipientTypeDetails RoomMailbox, EquipmentMailbox | foreach-object {Get-CalendarProcessing $_.alias | select identity, AllowConflicts, ConflictPercentageAllowed, MaximumConflictInstances | where {($_.MaximumConflictInstances >=1) -and ($_.AllowConflicts -eq $true) -and ($_.ConflictPercentageAllowed >=1)}} | export-csv h:\test12346.csv
But I'm getting this below error
out-file : Access to the path 'C:\Windows\System32\=1' is denied.
At line:1 char:212
+ ... nces | where {($_.MaximumConflictInstances >=1) -and ($_.AllowConflicts -eq $tru ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (:) [Out-File], UnauthorizedAccessException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
I know potentially or my condition syntaxes are incorrect for the MaximumConflictInstances and or AllowConflicts paramters because when I ran the below command (partially of initial command), it works fine as expected
Get-mailbox -RecipientTypeDetails RoomMailbox, EquipmentMailbox | foreach-object {Get-CalendarProcessing $_.alias | select ide
ntity, AllowConflicts, ConflictPercentageAllowed, MaximumConflictInstances | where {($_.AllowConflicts -eq $true)}} | export-csv h:\allowC.csv
I've tried the below and now appears I'm missing something. Is someone able to help me review my code and advise what I'm missing?
Get-mailbox -RecipientTypeDetails RoomMailbox, EquipmentMailbox | foreach-object {Get-CalendarProcessing $_.alias | select identity, AllowConflicts, ConflictPercentageAllowed, MaximumConflictInstances | where {($_.AllowConflicts -eq $true) -and {($_.MaximumConflictInstances -gt 1) -OR ($_.ConflictPercentageAllowed -gt 1)}} | export-csv h:\test12346.csv
Long story short, im just trying to export all exchange room objects and equipment objects if their paramters - allowconflicts is set to TRUE, and MaximumConflictInstances & ConflictPercentageAllowed is equals to OR greater than 1 for both
Thanks Rob
When doing a comparison, PowerShell does not use the ">=" comparison operator. It should look like this:
You can review the PowerShell comparison operators here: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-6