Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem with Exchange server monitoring

Problem with Exchange server monitoring

Scheduled Pinned Locked Moved C#
windows-adminhelpdatabasesysadminlinux
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sebastian T Xavier
    wrote on last edited by
    #1

    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 query Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin. But I need it to be executed from a remote machine, so I have executed it from my powershell console , as follows... $server='192.168.1.23';$pwd= convertto-securestring '123' -asplaintext -force;$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist 'exchangeserver\Administrator',$pwd; invoke-command -computername $server -credential $cred -scriptblock {Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin get-mailbox | FL} But, this query fails with the following error...

    A positional parameter cannot be found that accepts argument 'get-mailbox'.

    +CategoryInfo :InvalidArgument: {:} [Add-PSSnapin], ParameterBIndingException
    +FullyQualifiedErrorId: PositionalParameterNotFound,Microsoft.Powershell.Commands.AddPSSnapinCommand

    I have modified this query again and added a ; after the snapin add section. $server='192.168.1.23';$pwd= convertto-securestring '123' -asplaintext -force;$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist 'exchangeserver\Administrator',$pwd; invoke-command -computername $server -credential $cred -scriptblock {Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin; get-mailbox | FL} This is also fails with the following error.

    Active Directory server exchangeserver.xxxxxx.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
    

    Then I have removed the add-snap-in section from the command and executed again. $server='192.168.1.23';$pwd= convertto-securestring '123' -asplaintext -force;$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist 'exchangeserver\Administrator',$pwd; invoke-command -computername $server -credential $cred -scriptblock {get-mailbox | FL} Now it throws another error message.

    The term 'get-mailbox' is not recognised as the name of a cmdlet, function,

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups