Scotch Tech
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).Rec eiveProtoc olLogPath
but get this error:
Set-Location : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Path'. Specified method is not supported.
set-location (Get-TransportService).Rec
but get this error:
Set-Location : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Path'. Specified method is not supported.
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
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.
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
Although you'd probably have to do something like:
Set-Location $exinstall + 'TransportRoles\Logs\Hub\P rotocolLog \SmtpRecei ve'
https://technet.microsoft.com/en-us/library/aa997624(v=exchg.150).aspx
Although you'd probably have to do something like:
Set-Location $exinstall + 'TransportRoles\Logs\Hub\P
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.
Set-Location : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Path'. Specified method is not supported.
ASKER
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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..
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..
(Get-TransportServer HOSTNAME).ReceiveProtocolL