-
Notifications
You must be signed in to change notification settings - Fork 0
/
out-StatusFile.ps1
62 lines (41 loc) · 1.82 KB
/
out-StatusFile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<#
.SYNOPSIS
This function writes the status file for migrations.
.DESCRIPTION
Logging
.PARAMETER threadNumber
Boolean value to signify exception / log it / terminate script.
.OUTPUTS
Logs all activities and backs up all original data to the log folder directory.
.EXAMPLE
Out-LogFile -string "MESSAGE" -isError BOOLEAN
#>
Function Out-StatusFile
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory = $false)]
[int]$threadNumber=0
)
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN OUT-STATUSFILE"
Out-LogFile -string "********************************************************************************"
#Define the status file.
[array]$threadStatus="ThreadZeroStatus.txt","ThreadOneStatus.txt","ThreadTwoStatus.txt","ThreadThreeStatus.txt","ThreadFourStatus.txt","ThreadFiveStatus.txt","ThreadSixStatus.txt","ThreadSevenStatus.txt","ThreadEightStatus.txt","ThreadNineStatus.txt","ThreadTenStatus.txt"
[string]$statusString="DONE"
[String]$functionStatus = Join-path $global:fullStatusPath $threadStatus[$threadNumber]
out-logFile -string $functionStatus
#Write the generic thread to the file - we only care that the file was created.
try
{
$statusString | Out-File -FilePath $functionStatus -force
}
catch
{
out-logfile $_ -isError:$TRUE
}
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "END OUT-STATUSFILE"
Out-LogFile -string "********************************************************************************"
}