首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么它说-Alias不存在于Powershell集邮箱中?

问为什么它说-Alias不存在于Powershell集邮箱中?
EN

Stack Overflow用户
提问于 2019-07-29 16:04:47
回答 1查看 574关注 0票数 0

我正在运行下面的代码,我想尝试设置Alias来测试我是否有到exchange服务器的管理凭证,但是它回来了,说找不到Alias参数。

代码语言:javascript
复制
do {
    $success = $False
    $UserCredential = Get-Credential -Message "Enter your Exchange admin credentials"

    try
    {
        $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://sign.chlis.domain/powershell -Credential $UserCredential -Authentication Kerberos -AllowRedirection
        $output = Import-PSSession $Session -DisableNameChecking -AllowClobber
        Set-Mailbox -Identity tod.wch@gosis.com -Alias "test.test" -WhatIf
        $success = $True
    }
    Catch
    {
        $ErrorMessage = $_.Exception.Message
        $FailedItem = $_.Exception.ItemName
        Write-Host "`nERROR: Credentials did not work to connect to Exchage, try again" -ForegroundColor Red
        Write-Host "`t$ErrorMessage :: $FailedItem`n" -ForegroundColor Red
        $success = $False
    }
} Until ($success)

我输入了我的非管理员凭据,只需获得以下内容

代码语言:javascript
复制
A parameter cannot be found that matches parameter name 'Alias'.
    + CategoryInfo          : InvalidArgument: (:) [Set-Mailbox], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Set-Mailbox
    + PSComputerName        : sign.chlis.domain
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-30 18:40:37

好的,看起来session正在识别我是用管理凭证连接到exchange会话还是不使用管理凭据,而当我没有以管理员身份登录时,它就不会给Alias参数,因为如果没有管理凭据,我就无法更改它。一旦我连接到管理员凭据,那么Alias参数就可以工作了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57257575

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档