PowerShell脚本气球提示不显示$ variable输出

时间:2015-10-16 14:43:55

标签: powershell exchange-server office365

我有一个与在线交换PowerShell相关的脚本。此脚本将邮件项目从已删除的邮箱移动到新邮箱,一旦完成,将显示带有状态的气球提示。气球提示脚本有一个$变量,它没有显示正确的输出。

脚本如下: -

$User = "Admin@domain.com"
$mypass = cat "C:\pass.txt" | convertTo-securestring -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ("$User", $mypass)
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $mycreds -Authentication Basic -AllowRedirection
Import-PSSession $Session
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.VisualBasic")
$DeletedUser = [Microsoft.VisualBasic.Interaction]::InputBox("Enter Deleted Mailbox Email Address", "Deleted Mailbox")
$UserMailbox = [Microsoft.VisualBasic.Interaction]::InputBox("Enter Destination Mailbox Email Address", "Destination Mailbox")
$DeletedGUID = Get-Mailbox -SoftDeletedMailbox $DeletedUser | fw guid
$DestinationGUID = Get-Mailbox $UserMailbox | fw guid 
New-MailboxRestoreRequest -SourceMailbox $DeletedGUID -TargetMailbox $DestinationGUID -AllowLegacyDNMismatch
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$Status = Get-MailboxRestoreRequest | Get-MailboxRestoreRequestStatistics | FW StatusDetail
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon 
$objNotifyIcon.Icon = (join-path ([environment]::GetFolderPath('MyDocuments')) "EXO.ico")
$objNotifyIcon.BalloonTipIcon = "Error" 
$objNotifyIcon.BalloonTipText = "Mail Item move has $Status" 
$objNotifyIcon.BalloonTipTitle = "Operation $Status"
$objNotifyIcon.Visible = $True 
$objNotifyIcon.ShowBalloonTip(50000)

气球提示无法解析变量。有人可以帮忙吗? 在此先感谢!

0 个答案:

没有答案