Monitoring Exchangeserver 2007 using powershell
-
2012년 3월 12일 월요일 오전 11:56
Hello All,
I have a problem with Exchange server 2007. I was trying to execute the following query get-mailbox | FL. This query was working when I tried it in the Exchange server's power shell console after executing following snapin Add-PSSnapin Microsoft.Exchange.Management. PowerShell.Admi n.
But I need it to be executed from a remote machine, so I have executed it from same powershell console , as follows...
$server='192.168.1.23';$pwd= convertto-secur estring '123' -asplaintext -force;$cred=ne w-object -typename System.Manageme nt.Automation.P SCredential -argumentlist 'exchangeserver \Administrator' ,$pwd; invoke-command -computername $server -credential $cred -scriptblock {Add-PSSnapin Microsoft.Excha nge.Management. PowerShell.Admi n get-mailbox | FL}
But, this query fails with the following error...The term 'Get-mailboxdat
abase' is not recognised 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 corerct and try again.
I tried the above query from a remote machine, then I got the following error
A positional parameter cannot be found that accepts argument 'get-mailbox'.
+CategoryInfo :InvalidArgument: {:} [Add-PSSnapin], ParameterBIndin gException
+FullyQualifiedErrorId: PositionalParam eterNotFound,Mi crosoft.Powersh ell.Commands.Ad dPSSnapinComman d Can someone help me on this?
- 편집됨 Annie Joseph 2012년 3월 12일 월요일 오전 11:58
모든 응답
-
2012년 3월 12일 월요일 오후 8:05
Try adding a semi-colon (";") between Add-PSSnapin Microsoft.Excha
nge.Management. PowerShell.Admi n and get-mailbox | FL {Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin; get-mailbox | FL}However, the easiest method is to install the tools locally....
You can get the 64 bit tools off the DVD, or the 32 bit tools from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=11876Karl
My Blog: http://unlockpowershell.wordpress.com
My Book: Windows PowerShell 2.0 Bible
My E-mail: -join ("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})
- 편집됨 Karl Mitschke 2012년 3월 12일 월요일 오후 8:06
-
2012년 3월 13일 화요일 오전 4:45
Hi,
Thanks for your replay. I tried the way you said, in both local system and in remote system.
$server='192.16
8.1.23';$pwd= convertto-secur estring '123' -asplaintext -force;$cred=ne w-object -typename System.Manageme nt.Automation.P SCredential -argumentlist 'exchangeserver \Administrator' ,$pwd; invoke-command -computername $server -credential $cred -scriptblock {Add-PSSnapin Microsoft.Excha nge.Management. PowerShell.Admi n; get-mailbox | FL} but I got the following error in both the cases:
Active Directory server exchangeserver.*.local is not available. Error message: The supplied credential is invalid
+CategoryInfo : NotSpecified:{0:Int32}[Get-Mailbox], ADOperationException
+FullyQualifiedErrorId : A2B6F75B,Microsoft.Exchange.Management.RecipientTasks.GetMailbox
Can someone help me on this?
- 편집됨 Annie Joseph 2012년 3월 15일 목요일 오전 5:02

