Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2314

Powershell und O365 - Get-InboxRule

$
0
0

Hallo,

ich bin derzeit dabei über ein Powershell-Script die Regeln bestimmter Benutzer in unserer Domain auszulesen.

Dabei ist jedoch ein kleines Problem entstanden, dass sich nicht lösen lässt.

Laut der Office-Seite für Get-InboxRule sollten folgende Cmdlets angeboten werden:

Get-InboxRule
   [[-Identity] <InboxRuleIdParameter>]
   [-DescriptionTimeFormat <String>]
   [-DescriptionTimeZone <ExTimeZoneValue>]
   [-DomainController <Fqdn>]
   [-Mailbox <MailboxIdParameter>]
   [-IncludeHidden]
   [-BypassScopeCheck]
   [-SweepRules]
   [<CommonParameters>]



Mein Powershell bietet mir jedoch nur folgende Möglichkeiten

Get-InboxRule
-DescriptionTimeFormat
-Identity
-DescriptionTimeZone
-AsJob
-ErrorAction
-Verbose
-OutVariable
-InformationAction
-WarningVariable
-Debug
-PiplineVariable
-ErrorVariable
-OutBuffer
-WarningAction
-InformationVariable


Und ich benutze folgenden Code

cls
$office365UserPrincipalName = "benutzer@domain.unternehmen.com"
$PSExoPowershellModuleRoot = (Get-ChildItem -Path $env:userprofile -Filter CreateExoPSSession.ps1 -Recurse -ErrorAction SilentlyContinue -Force | Select -Last 1).DirectoryName
$ExoPowershellModule = "Microsoft.Exchange.Management.ExoPowershellModule.dll";
$ModulePath = [System.IO.Path]::Combine($PSExoPowershellModuleRoot, $ExoPowershellModule);

Import-Module $ModulePath;

$Office365PSSession = New-ExoPSSession -UserPrincipalName $office365UserPrincipalName -ConnectionUri "https://outlook.office365.com/powershell-liveid/"

Import-PSSession $Office365PSSession Set-Mailbox,Set-MailboxAutoReplyConfiguration,Set-MailboxMessageConfiguration,Get-InboxRule,Remove-InboxRule,Get-SweepRule,Remove-SweepRule,Search-Mailbox -Verbose -AllowClobber

Get-InboxRule 


An dieser stelle würde ich dann gerne "Get-InboxRule -Mailbox andererUser@domain.unternehmen.com" auslesen.

Die "-Mailbox"-Funktion wird mir jedoch nicht angeboten und führt nur zu Fehlern:

A parameter cannot be found that matches parameter name 'Mailbox'.+ CategoryInfo          : InvalidArgument: (:) [Get-InboxRule], ParameterBindingException+ FullyQualifiedErrorId : NamedParameterNotFound,Get-InboxRule+ PSComputerName        : outlook.office365.com

 Leider kann ich noch keine Screenshots einfügen.

Danke für eure Hilfe im voraus :)

PS: Powershellversion laut $PSVersionTable

Name                           Value                                                                                                                                           
----                           -----                                                                                                                                           
PSVersion                      5.1.15063.1478                                                                                                                                  
PSEdition                      Desktop                                                                                                                                         
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                         
BuildVersion                   10.0.15063.1478                                                                                                                                 
CLRVersion                     4.0.30319.42000                                                                                                                                 
WSManStackVersion              3.0                                                                                                                                             
PSRemotingProtocolVersion      2.3                                                                                                                                             
SerializationVersion           1.1.0.1     


Viewing all articles
Browse latest Browse all 2314