本文介绍了惠普全面审计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在玩一个脚本来审核HP设备我一直在修改脚本获取我想要的详细信息,我正在尝试对邮箱和大小进行审核,但它会提供以下内容

I've been playing around with a script that audits HP equipment i've been amending the script to get details of what i want and i'm trying to get an audit of the mailboxes and size but it's coming up with the following

PS C:\ SystemReport> Get-HPServerHealth -ComputerName emailserver -IncludeExchangeMailbox

警告:HP服务器运行状况:emailserver:术语"Get-Mailbox"未被识别为cmdlet的名称,功能,

脚本文件或可操作程序。检查名称的拼写,或者如果包含路径,请验证路径是否为
正确并重试。

PS C:\SystemReport> Get-HPServerHealth -ComputerName emailserver -IncludeExchangeMailbox
WARNING: HP Server Health: emailserver: The term 'Get-Mailbox' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.

我想知道我在做错了什么是脚本抱歉它很大。   

I was wondering what i was doing wrong here is the script sorry it's quite big.   

						function LoadExchangeTools {

if (!(Get-pssnapin | ? {$_.name -like 'Microsoft.Exchange*'})) {
		$Reg = Get-PSSnapin -Registered | ? {$_.name -like 'Microsoft.Exchange*'}
		IF ($Reg | ? {$_.name -like '*e2010'}){
			Add-PSSnapin Microsoft.Exchange.Management.PowerShell.e2010
			}
		ElseIf($Reg | ? {$_.name -like '*Admin'}){
			Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
		}
	}
Else{
		"Exchange modules were not detected"
	}
}

						                        #region HBA
                        if ($IncludeExchangeMailbox)
                        {
                              LoadExchangeTools
                            Write-Verbose -Message ('Exchange Health: Runspace {0}: HP Mailbox information' -f 'emailserver')
                            $WMI_MailboxProps = @('DisplayName','TotalItemSize')
                            $wmi_Mailbox = @(Get-Mailbox -ResultSize Unlimited | Get-mailboxstatistics | `
                                       Select $WMI_MailboxProps)
                            $_MailboxHealth = @()
                            foreach ($Mailbox in $wmi_Mailbox)
                            {
                                $MailboxProp = @{
                                    'DisplayName' = $Mailbox.DisplayName
									'TotaltemSize' = $Mailbox.TotalItemSize
                                }
                                $_MailboxHealth += New-Object PSObject -Property $MailboxProp
                            }
                            $ResultProperty._MailboxHealth = $_MailboxHealth
                        }
                        #endregion HBA

推荐答案

赔率是,您没有在运行此脚本的计算机上安装Exchange 2010 Shell。您可以使用Exchange安装程序安装它们,仅选择管理工具。

odds are, you do not have the Exchange 2010 Shell installed on the computer running this script. You can install them using the Exchange Installer, selecting the administrative tools only.

如果您安装了其他版本,将Add-PSSnapin部分的脚本调整为正确的数字。

If you have another version installed, adapt the script at the Add-PSSnapin part to the correct number.

干杯,

Fred

Cheers,
Fred


这篇关于惠普全面审计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 19:12