Moving ALL log files to different hard drive

Hello,

I have already moved the database to a separate RAID5 array and would now like to move all log files to a separate RAID1 array. I have found this script:

--------------------------------------------------------------------------------------------------------------------------------------------

# MoveMail1logs.ps1

# Version 1.0 by KSB

# This script will move all of the configurable logs for  Exchange 2013 from the C: drive

# to the L: drive.  The folder subtree and  paths on L: will stay the same as they were on C:

#

# Get the name of the local computer and  set it to a variable for use later on.

$exchangeservername = $env:mail1

# Move the standard log files for  the TransportService to the same path on the L: drive that they were on C: 

Set-TransportService -Identity $exchangeservername  `

-ConnectivityLogPath "E:\TransportRoles\Logs\Hub\Connectivity" `

-MessageTrackingLogPath "E:\TransportRoles\Logs\MessageTracking" `

-IrmLogPath "E:\Logging\IRMLogs" `

-ActiveUserStatisticsLogPath "E:\TransportRoles\Logs\Hub\ActiveUsersStats" `

-ServerStatisticsLogPath "E:\TransportRoles\Logs\Hub\ServerStats" `

-ReceiveProtocolLogPath "E:\TransportRoles\Logs\Hub\ProtocolLog\SmtpReceive" `

-RoutingTableLogPath "E:\TransportRoles\Logs\Hub\Routing" `

-SendProtocolLogPath "E:\TransportRoles\Logs\Hub\ProtocolLog\SmtpSend" `

-QueueLogPath "E:\TransportRoles\Logs\Hub\QueueViewer" `

-WlmLogPath "E:\TransportRoles\Logs\Hub\WLM" `

-PipelineTracingPath "E:\TransportRoles\Logs\Hub\PipelineTracing" `

-AgentLogPath "E:\TransportRoles\Logs\Hub\AgentLog"

# move the path for  the PERFMON logs from the C: drive to the L: drive

logman -stop ExchangeDiagnosticsDailyPerformanceLog

logman -update ExchangeDiagnosticsDailyPerformanceLog -o "E:\Logging\Diagnostics\DailyPerformanceLogs\ExchangeDiagnosticsDailyPerformanceLog"

logman -start ExchangeDiagnosticsDailyPerformanceLog

logman -stop ExchangeDiagnosticsPerformanceLog

logman -update ExchangeDiagnosticsPerformanceLog -o "E:\Logging\Diagnostics\PerformanceLogsToBeProcessed\ExchangeDiagnosticsPerformanceLog"

logman -start ExchangeDiagnosticsPerformanceLog

------------------------------------------------------------------

# Get the details on the EdgeSyncServiceConfig and  store them in a variable for use in setting the path

$EdgeSyncServiceConfigVAR=Get-EdgeSyncServiceConfig

# Move the Log Path using the variable we got

Set-EdgeSyncServiceConfig -Identity $EdgeSyncServiceConfigVAR.Identity -LogPath "E:\TransportRoles\Logs\EdgeSync"

------------------------------------------------------------------

# Move the standard log files for  the FrontEndTransportService to the same path on the L: drive that they were on C:

Set-FrontendTransportService  -Identity $exchangeservername  `

-AgentLogPath "E:\TransportRoles\Logs\FrontEnd\AgentLog" `

-ConnectivityLogPath "E:\TransportRoles\Logs\FrontEnd\Connectivity" `

-ReceiveProtocolLogPath "E:\TransportRoles\Logs\FrontEnd\ProtocolLog\SmtpReceive" `

-SendProtocolLogPath "E:\TransportRoles\Logs\FrontEnd\ProtocolLog\SmtpSend"

# MOve the log path for  the IMAP server

Set-ImapSettings -LogFileLocation "E:\Logging\Imap4"

# Move the logs for  the MailBoxServer

Set-MailboxServer -Identity $exchangeservername  `

-CalendarRepairLogPath "E:\Logging\Calendar Repair Assistant" `

-MigrationLogFilePath  "E:\Logging\Managed Folder Assistant"

# Move the standard log files for  the MailboxTransportService to the same path on the L: drive that they were on C:

Set-MailboxTransportService -Identity $exchangeservername  `

-ConnectivityLogPath "E:\TransportRoles\Logs\Mailbox\Connectivity" `

-MailboxDeliveryAgentLogPath "E:\TransportRoles\Logs\Mailbox\AgentLog\Delivery" `

-MailboxSubmissionAgentLogPath "E:\TransportRoles\Logs\Mailbox\AgentLog\Submission" `

-ReceiveProtocolLogPath "E:\TransportRoles\Logs\Mailbox\ProtocolLog\SmtpReceive" `

-SendProtocolLogPath "E:\TransportRoles\Logs\Mailbox\ProtocolLog\SmtpSend" `

-PipelineTracingPath "E:\TransportRoles\Logs\Mailbox\PipelineTracing"

# MOve the log path for  the POP3 server

Set-PopSettings -LogFileLocation "E:\Logging\Pop3"

--------------------------------------------------------------------------------------------------------------------------------------------

All of it looks pretty straight forward except for a couple lines which are:

# Get the details on the EdgeSyncServiceConfig and  store them in a variable for use in setting the path

$EdgeSyncServiceConfigVAR=Get-EdgeSyncServiceConfig

# Move the Log Path using the variable we got

Set-EdgeSyncServiceConfig -Identity $EdgeSyncServiceConfigVAR.Identity -LogPath "E:\TransportRoles\Logs\EdgeSync"

If I run the $EdgeSyncServiceConfigVAR=Get-EdgeSyncServiceConfig it sounds like it should give me a variable in return to use in the next line but running that command returns nothing. It looks like it runs successfully but just puts me back at the prompt.

Should it return something or is it just setting the variable to $EdgeSyncServiceConfigVAR and I should just run the next line as is after changing the path I want?

Does anyone have experience with this script?

Are these ALL the log files to move?

Thanks,

Jeff

September 4th, 2015 9:07pm

When you run $var = get-xxx, the output of the command is stored in $var. If you want to see it, just run $var after that.


  • Edited by Li Zhen 2 hours 33 minutes ago
Free Windows Admin Tool Kit Click here and download it now
September 5th, 2015 12:58am

When you run $var = get-xxx, the output of the command is stored in $var. If you want to see it, just run $var after that.


  • Edited by Li Zhen Saturday, September 05, 2015 4:57 AM
September 5th, 2015 4:57am

When you run $var = get-xxx, the output of the command is stored in $var. If you want to see it, just run $var after that.


  • Edited by Li Zhen Saturday, September 05, 2015 4:57 AM
Free Windows Admin Tool Kit Click here and download it now
September 5th, 2015 4:57am

When you run $var = get-xxx, the output of the command is stored in $var. If you want to see it, just run $var after that.


  • Edited by Li Zhen Saturday, September 05, 2015 4:57 AM
September 5th, 2015 4:57am

If I run $var after running the other command it just does the same thing, it looks like it runs OK, no errors, but just comes back to the prompt.

Free Windows Admin Tool Kit Click here and download it now
September 5th, 2015 9:20am

That means the get- command returns nothing.

Btw, are you using a pre-SP1 version of Exchange 2013?

  • Edited by Li Zhen 15 hours 10 minutes ago
September 5th, 2015 10:57am

Hi.

Move Logging in Exchange 2013 via Powershell

Moving Exchange 2013 Logging Directory

I recommend to test and validate the scripts in the test area.

Free Windows Admin Tool Kit Click here and download it now
September 5th, 2015 11:57am

That means the get- command returns nothing.

Btw, are you using a pre-SP1 version of Exchange 2013?

  • Edited by Li Zhen Saturday, September 05, 2015 4:12 PM
September 5th, 2015 2:57pm

That means the get- command returns nothing.

Btw, are you using a pre-SP1 version of Exchange 2013?

  • Edited by Li Zhen Saturday, September 05, 2015 4:12 PM
Free Windows Admin Tool Kit Click here and download it now
September 5th, 2015 2:57pm

That means the get- command returns nothing.

Btw, are you using a pre-SP1 version of Exchange 2013?

  • Edited by Li Zhen Saturday, September 05, 2015 4:12 PM
September 5th, 2015 2:57pm

Hi,

What's the result of this command?

Get-EdgeSyncServiceConfig

Best Regards.

Free Windows Admin Tool Kit Click here and download it now
September 7th, 2015 4:41am

Results of running Get-EdgeSyncServiceConfig:

Site - Default-First-Site-Name

LogEnabled - True

LogLevel - None

September 8th, 2015 4:01pm

Running Exchange 2013 SP1 and installed CU9 after initial installation.
Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 4:02pm

Results of running Get-EdgeSyncServiceConfig:

Site - Default-First-Site-Name

LogEnabled - True

LogLevel - None


I see nothing wrong here. So what's the problem exactly?
September 9th, 2015 2:24am

Hi Jpru9988,

When you run a command directly it formats the output as per a predefined default formatting.

For Example:

#Without FL it returns selective formatted values
Get-Process explorer

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName
-------  ------    -----      ----- -----   ------     -- -----------
   1066      67    57752      19940   383   128.45   4192 explorer


#Format-List * gives all the values
Get-Process explorer | fl *


__NounName                 : Process
Name                       : explorer
Handles                    : 1066
VM                         : 401846272
WS                         : 20418560
PM                         : 59138048
NPM                        : 69112
Path                       : C:\windows\Explorer.EXE

Hence in your case:

Run this to get list all the values that it returns.

Get-EdgeSyncServiceConfig | fl *

Or if you run this it will give you the ID used in the move section:

Get-EdgeSyncServiceConfig | ft Identity

"$((Get-EdgeSyncServiceConfig).Identity)"


In the Li's example he had used the variable as $var and your script\example has the variable $EdgeSyncServiceConfigVAR, hence if you pass the info to $EdgeSyncServiceConfigVAR and try to view $var you will see empty data

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 5:18am

Nope.

When you run $var or $EdgeSyncServiceConfigVAR, you'll see exactly what you see when you run the command without assigning to the variable.


  • Edited by Li Zhen 21 hours 58 minutes ago
September 9th, 2015 5:23am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics