7070 Catch {
7171 $ErrorMessage = $_.Exception.Message
7272 $FailedItem = $_.Exception.ItemName
73- Log- Error - LogPath $FullLogPath - ErrorDesc " Error durring config creation: $FailedItem , $ErrorMessage `n $Error [0]"
73+ Log- Error - LogPath $FullLogPath - ErrorDesc " Error durring config creation: $FailedItem , $ErrorMessage `n $Error [0]" - ExitGracefully $True
7474 }
7575 }
7676 Else {
9696 # MySQL connection info
9797 $MySQLDatabase = $Config.Settings.MySQLDatabase
9898 $MySQLHost = $Config.Settings.MySQLHost
99- $MySQLAdminPassword = (IMPORT-CLIXML $CredPath \LTDBCredentials.xml).GetNetworkCredential().Password
100- $MySQLAdminUserName = (IMPORT-CLIXML $CredPath \LTDBCredentials.xml).GetNetworkCredential().UserName
99+ $MySQLAdminPassword = (IMPORT-CLIXML " $CredPath \LTDBCredentials.xml" ).GetNetworkCredential().Password
100+ $MySQLAdminUserName = (IMPORT-CLIXML " $CredPath \LTDBCredentials.xml" ).GetNetworkCredential().UserName
101101
102102# endregion
103103
@@ -436,7 +436,7 @@ Function Get-LTData {
436436 }
437437
438438 Catch {
439- Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to run query : $query `n $Error [0]"
439+ Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to run query : $query `n $Error [0]" - ExitGracefully $True
440440 }
441441 }
442442
@@ -572,7 +572,7 @@ Function Export-LTScript {
572572 Catch {
573573 $ErrorMessage = $_.Exception.Message
574574 $FailedItem = $_.Exception.ItemName
575- Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to remove folder data from XML: $FailedItem , $ErrorMessage `n $Error [0]"
575+ Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to remove folder data from XML: $FailedItem , $ErrorMessage `n $Error [0]" - ExitGracefully $True
576576 }
577577 }
578578 Else {
@@ -595,7 +595,7 @@ Function Export-LTScript {
595595 Catch {
596596 $ErrorMessage = $_.Exception.Message
597597 $FailedItem = $_.Exception.ItemName
598- Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to remove folder data from XML: $FailedItem , $ErrorMessage `n $Error [0]"
598+ Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to remove folder data from XML: $FailedItem , $ErrorMessage `n $Error [0]" - ExitGracefully $True
599599 }
600600 }
601601 Else {
@@ -631,7 +631,7 @@ Function Export-LTScript {
631631 Catch {
632632 $ErrorMessage = $_.Exception.Message
633633 $FailedItem = $_.Exception.ItemName
634- Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to save script: $FailedItem , $ErrorMessage `n $Error [0]"
634+ Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to save script: $FailedItem , $ErrorMessage `n $Error [0]" - ExitGracefully $True
635635 }
636636 }
637637 Else {
@@ -662,7 +662,7 @@ Function Export-LTScript {
662662 Catch {
663663 $ErrorMessage = $_.Exception.Message
664664 $FailedItem = $_.Exception.ItemName
665- Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to save script: $FailedItem , $ErrorMessage `n $Error [0]"
665+ Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to save script: $FailedItem , $ErrorMessage `n $Error [0]" - ExitGracefully $True
666666 }
667667 }
668668
@@ -673,7 +673,6 @@ Function Export-LTScript {
673673# region-[Execution]------------------------------------------------------------
674674 try {
675675 # Create log
676- if ((Test-Path $Config.Settings.LogPath ) -eq $false ){New-Item - ItemType Directory - Force - Path $Config.Settings.LogPath | Out-Null }
677676 Log- Start - LogPath $LogPath - LogName $LogName - ScriptVersion $ScriptVersion - Append
678677
679678 # Check backup directory
@@ -682,7 +681,7 @@ Function Export-LTScript {
682681 Catch {
683682 $ErrorMessage = $_.Exception.Message
684683 $FailedItem = $_.Exception.ItemName
685- Log- Error - FullLogPath $FullLogPath - ErrorDesc " Error durring log/backup directory creation: $FailedItem , $ErrorMessage `n $Error [0]"
684+ Log- Error - FullLogPath $FullLogPath - ErrorDesc " Error durring log/backup directory creation: $FailedItem , $ErrorMessage `n $Error [0]" - ExitGracefully $True
686685 }
687686
688687 Log- Write - FullLogPath $FullLogPath - LineValue " Getting list of all scripts."
@@ -719,7 +718,7 @@ Function Export-LTScript {
719718 Catch {
720719 $ErrorMessage = $_.Exception.Message
721720 $FailedItem = $_.Exception.ItemName
722- Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to update config with last export date: $FailedItem , $ErrorMessage `n $Error [0]"
721+ Log- Error - FullLogPath $FullLogPath - ErrorDesc " Unable to update config with last export date: $FailedItem , $ErrorMessage `n $Error [0]" - ExitGracefully $True
723722 }
724723
725724 Log- Finish - FullLogPath $FullLogPath
0 commit comments