Link to home
Start Free TrialLog in
Avatar of Scotch Tech
Scotch TechFlag for United States of America

asked on

Exchange 2013 - Powershell cmd error

I'm trying to set the location to search my Transport logs. I used command:

set-location (Get-TransportService).ReceiveProtocolLogPath

but get this error:

Set-Location : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Path'. Specified method is not supported.
Avatar of Jason Crawford
Jason Crawford
Flag of United States of America image

Try this:

(Get-TransportServer HOSTNAME).ReceiveProtocolLogPath.PathName
You would need to replace hostname with the actual server name
Obviously Get-TransportServer returns data for more than one server at your location. I suppose you are running this on the edge server itself (otherwise it would not make sense), so you can indeed run something similar to what Jason posted:
set-location (Get-TransportService $env:Computername).ReceiveProtocolLogPath

Open in new window

I don't think it's Get-TransportService, the only ReceiveProtocolLogPath property I could find was found in Get-TransportServer.  You may want to verify verbose logging is actually enabled on at least one Receive Connector.  I always enable it on all my RCs:

Get-ReceiveConnector | Set-ReceiveConnector -ProtocolLoggingLevel Verbose

At the end of the day storage is cheap and these logs have saved my a** many times so don't sweat the space requirements.
Or here's another method:

https://technet.microsoft.com/en-us/library/aa997624(v=exchg.150).aspx

User generated image
Although you'd probably have to do something like:

Set-Location $exinstall + 'TransportRoles\Logs\Hub\ProtocolLog\SmtpReceive'
Avatar of Scotch Tech

ASKER

Thanks. I've tried both suggestions however with Get-Server or Get-Service I still receive the error:

Set-Location : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Path'. Specified method is not supported.
I take it back, both commands worked, sorry for the confusion.

But I do not have an EDGE server, I'm running on one of the DAG members, how can i search all servers with one command without having to run for each server?
SOLUTION
Avatar of Jason Crawford
Jason Crawford
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ah right I forgot the whole point of this was to set the working directory.  Qlemo is right it depends largely on specifically what you're doing.
As said above, Jason's suggestion is not really appliable to your question - you won't be able to use it as-is in conjunction with Set-Location. That requires some more code, similar to what I've used in the loop body.

Also note the comment of the Get-TransportServer help: The Get-TransportServer cmdlet will be removed in a future version of Exchange. You should use the Get-TransportService cmdlet instead..