forked from timmcmic/DLConversionV2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Out-XMLFile.ps1
78 lines (51 loc) · 1.88 KB
/
Out-XMLFile.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<#
.SYNOPSIS
This function backs up the data for relevant entries to XML.
.DESCRIPTION
Backup to XML
.PARAMETER itemToExport
This is the item to export to XML
.PARAMETER logFolderPath
The path of the log file.
.PARAMETER itemNameToExport
What the XML file will be named.
.OUTPUTS
Backs up the associated information to XML.
.EXAMPLE
Out-XMLFile -itemToExport ITEM -logFolderPath Path -itemNameToExport
#>
Function Out-XMLFile
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory = $true)]
$itemToExport,
[Parameter(Mandatory = $true)]
[string]$itemNameToExport
)
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN OUT-XMLFILE"
Out-LogFile -string "********************************************************************************"
#Declare function variables.
$fileName = $itemNameToExport+".xml"
#Update the log folder path to include the static folder.
$logFolderPath = $logFolderPath+$global:staticFolderName
# Get our log file path and combine it with the filename
$LogFile = Join-path $logFolderPath $fileName
#Write our variables to the log.
out-logfile -string ("XML File Name = "+$fileName)
out-logfile -string ("Log Folder Path = "+$logFolderPath)
out-logfile -string ("Log File = "+$LogFile)
# Write everything to our log file and the screen
try
{
$itemToExport | export-CLIXML -path $LogFile
}
catch
{
throw $_
}
Out-LogFile -string "END OUT-XMLFILE"
Out-LogFile -string "********************************************************************************"
}