-
Notifications
You must be signed in to change notification settings - Fork 0
/
Docu-StoreFront.ps1
6894 lines (6589 loc) · 318 KB
/
Docu-StoreFront.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<#
.SYNOPSIS
Creates documentation of a 3.x / 19xx StoreFront server cluster
.DESCRIPTION
This PowerShell script uses the StoreFront PowerShell SDK to create StoreFront documentation.
The script uses the PScribo documentation framework written by Iain Brighton
(https://github.com/iainbrighton/PScribo) to render the output in any of the following formats:
- MS Word
- HTML
- Text
The script may used in command-line or GUI (default) mode. Command-line mode is useful for unattended
documentation generation, while GUI mode expects input from the user before continuing.
The script must be run in an elevated PowerShell session (Admin mode).
To run this script without regard to the current execution policy, execute the script as follows:
> powershell.exe -executionPolicy bypass -file <directory>\Docu-StoreFront.ps1 <parameters>
.PARAMETER paramGUI
Alias: GUI
Use a graphical form to accept parameters from the user.
Note: GUI mode will also accept parameters passed on the command line.
Default: True (use -GUI:$False to turn off)
.PARAMETER paramWord
Alias: Word
Generate the document in MS Word format.
Default: True (use -Word:$False to turn off)
.PARAMETER paramHTML
Alias: HTML
Generate the document in HTML format.
Default: True (use -HTML:$False to turn off)
.PARAMETER paramText
Alias: Text
Generate the document in Text format.
Default: False (use -Text to turn on)
.PARAMETER paramDirectory
Alias: Dir
Directory in which to place the generated documentation
Default: Current working directory.
.PARAMETER paramFile
Alias: FileName
Base name of the generated output file(s).
Note: Extensions will be automatically be added for each document type generated.
MS Word: .doc HTML: .html Text: .txt
Default: <computer name> - StoreFront Documentation
.PARAMETER paramTitle
Alias: Title
Title of the document (placed on the first page)
Default: StoreFront Documentation -
<computer name>
.PARAMETER paramAuthor
Alias: Author
Author of the document (placed on the first page)
Default: $env:username
.PARAMETER Hardware
Use WMI to gather hardware information on: Computer System, Disks, Processor and Network Interface Cards
for each member in the server group.
This parameter requires the script be run from an account with permission to retrieve hardware information.
Selecting this parameter will add to both the time it takes to run the script and size of the report.
Default: False (use -Hardware to turn on)
.PARAMETER Software
Read the registry to obtain a list of installed software, as well as Citrix services installed
for each member in the server group.
This parameter requires the script be run from an account with permission to read the registry.
Selecting this parameter will add to both the time it takes to run the script and size of the report.
You may exclude specific software by including their application names (wildcards allowed) in a file called
SoftWareExclusions.txt in the same directory as the running script (see the sample file included).
Default: False (use -Software to turn on)
.EXAMPLE
> powershell.exe -executionPolicy bypass -file c:\Scripts\Docu-StoreFront.ps1
Will use all default values.
.EXAMPLE
> powershell.exe -executionPolicy bypass -file c:\Scripts\Docu-StoreFront.ps1 -GUI:$False -FN "IPM-SF" -Dir "C:\Output" -Hardware
Will gather hardware information for the host server, and
will create the file(s) IPM-SF.<extension> in directory C:\Output without using the GUI.
.EXAMPLE
> .\Docu-StoreFront.ps1 -Dir c:\temp -File StoreFront -Title "My SF Doc" -Author "Sam Jacobs" -Text -Word:$False
Will use the GUI and populate it with the base file name of "StoreFront", the title of "My SF Doc"
the author "Sam Jacobs", and will add Text output to the default list, and remove MS Word output
.INPUTS
None. You cannot pipe objects to this script.
.OUTPUTS
No objects are output from this script.
This script creates one or more files in the following formats: MS Word, HTML, and text.
.NOTES
NAME: Docu-StoreFront.ps1
VERSION: 4.0
AUTHOR: Sam Jacobs
LASTEDIT: October 23, 2019
#>
Param(
[parameter(Mandatory=$False)]
[Alias("Word")]
[Switch]$paramWord=$True,
[parameter(Mandatory=$False)]
[Alias("PDF")]
[Switch]$paramPDF=$False,
[parameter(Mandatory=$False)]
[Alias("Text")]
[Switch]$paramText=$False,
[parameter(Mandatory=$False)]
[Alias("HTML")]
[Switch]$paramHTML=$True,
[parameter(Mandatory=$False)]
[Switch]$Hardware=$False,
[parameter(Mandatory=$False)]
[Switch]$Software=$False,
[parameter(Mandatory=$False)]
[Alias("Dir")]
[string]$paramDirectory="",
[parameter(Mandatory=$False)]
[Alias("FileName")]
[string]$paramFileName="",
[parameter(Mandatory=$False)]
[Alias("Title")]
[string]$paramTitle="",
[parameter(Mandatory=$False)]
[Alias("Author")]
[string]$paramAuthor="",
[parameter(Mandatory=$False)]
[Switch]$paramDebug=$False,
[parameter(Mandatory=$False)]
[Alias("GUI")]
[Switch]$paramGUI=$True
)
$SFDocVersion = "v4.0"
Write-Host ""
Write-Host "$(Get-Date): StoreFront Documentation Script $($SFDocVersion)"
# make sure script is running elevated
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Warning "This script needs to be run elevated.`nPlease re-run this script as an Administrator!"
Break
}
# process command line parameters & set defaults
Function setParamDefault($paramName, $defaultValue) {
if ($paramName -eq "") { return $defaultValue }
else { return $paramName }
}
Function iif($paramToCheck, $valueIfTrue, $valueIfFalse) {
if ($paramToCheck -eq $True) { return $valueIfTrue }
else { return $valueIfFalse }
}
$paramDirectory = setParamDefault $paramDirectory (Split-Path $script:MyInvocation.MyCommand.Path)
$paramFileName = setParamDefault $paramFileName "$($env:computername) StoreFront Documentation"
$paramTitle = setParamDefault $paramTitle "StoreFront Documentation - `r`n$($env:computername)"
$paramAuthor = setParamDefault $paramAuthor $env:username
$Script:OutputDir = $paramDirectory
$Script:OutputFile = $paramFileName
$Script:Title = $paramTitle
$Script:Author = $paramAuthor
$Script:OutputWord = $paramWord
$Script:OutputHTML = $paramHTML
$Script:OutputText = $paramText
$Script:Software = $Software
$Script:Hardware = $Hardware
Write-Verbose "$(Get-Date): Parameter OutputDir: $($Script:OutputDir)"
Write-Verbose "$(Get-Date): Parameter OutputFile: $($Script:OutputFile)"
Write-Verbose "$(Get-Date): Parameter Title: $($Script:Title)"
Write-Verbose "$(Get-Date): Parameter Author: $($Script:Author)"
Write-Verbose "$(Get-Date): Parameter OutputWord: $($Script:OutputWord)"
Write-Verbose "$(Get-Date): Parameter OutputHTML: $($Script:OutputHTML)"
Write-Verbose "$(Get-Date): Parameter OutputText: $($Script:OutputText)"
Write-Verbose "$(Get-Date): Parameter Software: $($Script:Software)"
Write-Verbose "$(Get-Date): Parameter Hardware: $($Script:Hardware)"
Write-Verbose "$(Get-Date): Parameter GUI: $($paramGUI)"
Write-Verbose "$(Get-Date): Parameter Debug: $($paramDebug)"
#region Documentation GUI
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# GUI component for StoreFront server documentation script
# Author: Sam Jacobs, IPM
# Created: July, 2014
# Version: 3.0
# Last Update: June 12, 2018
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$continueProcessing = $True
#~~< GUI Customizations go here >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# title used for the form and any pop-up message boxes
$GUI_title = "StoreFront Documentation Script $($SFDocVersion)"
#~~< Message Box buttons >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[int]$MB_OK = 0
[int]$MB_OK_CANCEL = 1
[int]$MB_ABORT_RETRY_IGNORE = 2
[int]$MB_YES_NO_CANCEL = 3
[int]$MB_YES_NO = 4
[int]$MB_RETRY_CANCEL = 5
#~~< Message Box icons >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[int]$MB_ICON_CRITICAL = 16
[int]$MB_ICON_QUESTION = 32
[int]$MB_ICON_WARNING = 48
[int]$MB_ICON_INFORMATIONAL = 64
#~~< GUI Functions >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function getDirectory($prompt) {
$objShell = New-Object -com Shell.Application
$selectedFolder = $objShell.BrowseForFolder(0,$prompt,0,0)
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($objShell) | Out-Null
return $selectedFolder
}
Function populateDirectory ($startDir) {
$selectedDir = getDirectory("Please select the documentation output directory:")
if ($selectedDir -ne $Null) {
$txtOutputDir.Text = $selectedDir.Self.Path
}
}
Function Abort_Script() {
$Script:continueProcessing = $False
$frmServer.Close()
}
Function Continue_Script() {
# save fields needed from form before closing
$Script:OutputFile = $txtOutputFile.Text
$Script:OutputDir = $txtOutputDir.Text
$Script:Title = $txtTitle.Text
$Script:Author = $txtAuthor.Text
$Script:OutputWord = ($chkWord.Checked -eq $True)
$Script:OutputHTML = ($chkHTML.Checked -eq $True)
$Script:OutputText = ($chkText.Checked -eq $True)
$Script:Software = ($chkSoftware.Checked -eq $True)
$Script:Hardware = ($chkHardware.Checked -eq $True)
if ( ($Script:OutputFile -eq "") -or ($Script:OutputDirectory -eq "") ) {
[System.Windows.Forms.MessageBox]::Show("Output directory and filename cannot be null!" ,
$GUI_title, $MB_OK, $MB_ICON_CRITICAL)
Return
}
# make sure the output directory actually exists!
If (!(Test-Path ($Script:OutputDir))) {
[System.Windows.Forms.MessageBox]::Show("Output directory does not exist!" ,
$GUI_title, $MB_OK, $MB_ICON_CRITICAL)
Return
}
if ( (! $Script:OutputWord) -and (! $Script:OutputHTML) -and (! $Script:OutputText) ) {
[System.Windows.Forms.MessageBox]::Show("Please select at least one output format!" ,
$GUI_title, $MB_OK, $MB_ICON_CRITICAL)
Return
}
$Script:continueProcessing = $True
$frmServer.Close()
}
if ($paramGUI -eq $True) {
Write-Verbose "$(Get-Date): Displaying GUI"
#~~< create the GUI >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null
$frmServer = New-Object System.Windows.Forms.Form
$btnExit = New-Object System.Windows.Forms.Button
$btnGenerate = New-Object System.Windows.Forms.Button
$groupBox3 = New-Object System.Windows.Forms.GroupBox
$chkHardware = New-Object System.Windows.Forms.CheckBox
$chkSoftware = New-Object System.Windows.Forms.CheckBox
$groupBox1 = New-Object System.Windows.Forms.GroupBox
$lblExt = New-Object System.Windows.Forms.Label
$btnSelectOutputDir = New-Object System.Windows.Forms.Button
$txtOutputDir = New-Object System.Windows.Forms.TextBox
$txtOutputFile = New-Object System.Windows.Forms.TextBox
$label4 = New-Object System.Windows.Forms.Label
$label3 = New-Object System.Windows.Forms.Label
$chkHTML = New-Object System.Windows.Forms.CheckBox
$chkWord = New-Object System.Windows.Forms.CheckBox
$chkPDF = New-Object System.Windows.Forms.CheckBox
$chkText = New-Object System.Windows.Forms.CheckBox
$label5 = New-Object System.Windows.Forms.Label
$label6 = New-Object System.Windows.Forms.Label
$txtTitle = New-Object System.Windows.Forms.TextBox
$txtAuthor = New-Object System.Windows.Forms.TextBox
##
## btnExit
##
$btnExit.Location = New-Object System.Drawing.Point(268, 424)
$btnExit.Name = "btnExit"
$btnExit.Size = New-Object System.Drawing.Size(147, 30)
$btnExit.TabIndex = 20
$btnExit.Text = "Exit"
$btnExit.UseVisualStyleBackColor = $True
$btnExit.add_Click({Abort_Script})
##
## btnGenerate
##
$btnGenerate.Location = New-Object System.Drawing.Point(57, 424)
$btnGenerate.Name = "btnGenerate"
$btnGenerate.Size = New-Object System.Drawing.Size(147, 30)
$btnGenerate.TabIndex = 19
$btnGenerate.Text = "Generate"
$btnGenerate.UseVisualStyleBackColor = $True
$btnGenerate.Add_Click({Continue_Script})
##
## groupBox3
##
$groupBox3.Controls.Add($chkHardware)
$groupBox3.Controls.Add($chkSoftware)
$groupBox3.Location = New-Object System.Drawing.Point(36, 319)
$groupBox3.Name = "groupBox3"
$groupBox3.Size = New-Object System.Drawing.Size(403, 88)
$groupBox3.TabIndex = 18
$groupBox3.TabStop = $False
$groupBox3.Text = " Optional "
##
## chkHardware
##
$chkHardware.AutoSize = $True
$chkHardware.Location = New-Object System.Drawing.Point(29, 26)
$chkHardware.Name = "chkHardware"
$chkHardware.Size = New-Object System.Drawing.Size(217, 17)
$chkHardware.TabIndex = 4
$chkHardware.Text = "Use WMI to gather hardware information"
$chkHardware.UseVisualStyleBackColor = $True
$chkHardware.Checked = ($Hardware -eq $True)
##
## chkSoftware
##
$chkSoftware.AutoSize = $True
$chkSoftware.Location = New-Object System.Drawing.Point(29, 55)
$chkSoftware.Name = "chkSoftware"
$chkSoftware.Size = New-Object System.Drawing.Size(217, 17)
$chkSoftware.TabIndex = 3
$chkSoftware.Text = "Query registry for installed software"
$chkSoftware.UseVisualStyleBackColor = $True
$chkSoftware.Checked = ($Software -eq $True)
##
## groupBox1
##
$groupBox1.Controls.Add($lblExt)
$groupBox1.Controls.Add($btnSelectOutputDir)
$groupBox1.Controls.Add($txtOutputDir)
$groupBox1.Controls.Add($txtOutputFile)
$groupBox1.Controls.Add($label4)
$groupBox1.Controls.Add($label3)
$groupBox1.Controls.Add($label5)
$groupBox1.Controls.Add($label6)
$groupBox1.Controls.Add($txtTitle)
$groupBox1.Controls.Add($txtAuthor)
$groupBox1.Controls.Add($chkWord)
$groupBox1.Controls.Add($chkHTML)
$groupBox1.Controls.Add($chkText)
$groupBox1.Location = New-Object System.Drawing.Point(34, 92)
$groupBox1.Name = "groupBox1"
$groupBox1.Size = New-Object System.Drawing.Size(405, 216)
$groupBox1.TabIndex = 21
$groupBox1.TabStop = $False
$groupBox1.Text = " Output "
##
## btnSelectOutputDir
##
$btnSelectOutputDir.Location = New-Object System.Drawing.Point(338, 28)
$btnSelectOutputDir.Name = "btnSelectOutputDir"
$btnSelectOutputDir.Size = New-Object System.Drawing.Size(37, 20)
$btnSelectOutputDir.TabIndex = 10
$btnSelectOutputDir.Text = "..."
$btnSelectOutputDir.UseVisualStyleBackColor = $True
$btnSelectOutputDir.Add_Click({populateDirectory($OutputDir)})
##
## txtOutputDir
##
$txtOutputDir.Location = New-Object System.Drawing.Point(114, 28)
$txtOutputDir.Name = "txtOutputDir"
$txtOutputDir.Size = New-Object System.Drawing.Size(215, 20)
$txtOutputDir.TabIndex = 9
$txtOutputDir.Text = $paramDirectory
##
## txtOutputFile
##
$txtOutputFile.Location = New-Object System.Drawing.Point(114, 60)
$txtOutputFile.Name = "txtOutputFile"
$txtOutputFile.Size = New-Object System.Drawing.Size(215, 20)
$txtOutputFile.TabIndex = 8
$txtOutputFile.Text = $paramFileName
##
## label4
##
$label4.AutoSize = $True
$label4.Location = New-Object System.Drawing.Point(25, 28)
$label4.Name = "label4"
$label4.Size = New-Object System.Drawing.Size(49, 13)
$label4.TabIndex = 1
$label4.Text = "Directory:"
##
## label3
##
$label3.AutoSize = $True
$label3.Location = New-Object System.Drawing.Point(25, 61)
$label3.Name = "label3"
$label3.Size = New-Object System.Drawing.Size(49, 13)
$label3.TabIndex = 0
$label3.Text = "Filename:"
##
## lblExt - formats
##
$lblExt.AutoSize = $True
$lblExt.Location = New-Object System.Drawing.Point(25, 94)
$lblExt.Name = "lblExt"
$lblExt.Size = New-Object System.Drawing.Size(34, 15)
$lblExt.TabIndex = 11
$lblExt.Text = "Formats:"
##
## chkWord
##
$chkWord.AutoSize = $True
$chkWord.Location = New-Object System.Drawing.Point(114, 94)
$chkWord.Name = "chkWord"
$chkWord.Size = New-Object System.Drawing.Size(75, 17)
$chkWord.TabIndex = 4
$chkWord.Text = "MS Word"
$chkWord.UseVisualStyleBackColor = $True
$chkWord.Checked = ($paramWord -eq $True)
##
## chkHTML
##
$chkHTML.AutoSize = $True
$chkHTML.Location = New-Object System.Drawing.Point(209, 94)
$chkHTML.Name = "chkHTML"
$chkHTML.Size = New-Object System.Drawing.Size(75, 17)
$chkHTML.TabIndex = 4
$chkHTML.Text = "HTML"
$chkHTML.UseVisualStyleBackColor = $True
$chkHTML.Checked = ($paramHTML -eq $True)
##
## chkText
##
$chkText.AutoSize = $True
$chkText.Location = New-Object System.Drawing.Point(284, 94)
$chkText.Name = "chkText"
$chkText.Size = New-Object System.Drawing.Size(75, 17)
$chkText.TabIndex = 4
$chkText.Text = "Text"
$chkText.UseVisualStyleBackColor = $True
$chkText.Checked = ($paramText -eq $True)
##
## label5
##
$label5.AutoSize = $True
$label5.Location = New-Object System.Drawing.Point(25, 144)
$label5.Name = "label5"
$label5.Size = New-Object System.Drawing.Size(49, 13)
$label5.TabIndex = 11
$label5.Text = "Title:"
##
## txtTitle
##
$txtTitle.Location = New-Object System.Drawing.Point(114, 144)
$txtTitle.Name = "txtTitle"
$txtTitle.Size = New-Object System.Drawing.Size(215, 20)
$txtTitle.TabIndex = 9
$txtTitle.Text = $paramTitle
##
## label6
##
$label6.AutoSize = $True
$label6.Location = New-Object System.Drawing.Point(25, 177)
$label6.Name = "label6"
$label6.Size = New-Object System.Drawing.Size(49, 13)
$label6.TabIndex = 11
$label6.Text = "Author:"
##
## txtAuthor
##
$txtAuthor.Location = New-Object System.Drawing.Point(114, 177)
$txtAuthor.Name = "txtAuthor"
$txtAuthor.Size = New-Object System.Drawing.Size(215, 20)
$txtAuthor.TabIndex = 9
$txtAuthor.Text = $paramAuthor
##
## frmServer
##
$frmServer.ClientSize = New-Object System.Drawing.Size(475, 483)
$frmServer.Controls.Add($groupBox1)
$frmServer.Controls.Add($btnExit)
$frmServer.Controls.Add($btnGenerate)
$frmServer.Controls.Add($groupBox3)
$frmServer.Name = "frmServer"
$frmServer.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen
$frmServer.Text = $GUI_title
#region formIcon
# form icon & logo - convert to base64
[string] $iconBase64=@"
iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAkZQTFRF//////7+/PXu+ejY9tzD9Na489Kw8s2p8cyl8s+r89Oz9di79+DK+u3g/fn2/vr2++7i9dm97bmF5p5X4pE+34Yr3XsZ23YP2nIJ2W4D2W0A2W8F2nML23cS3X8f4Ioy45VG6KZl8MWa9+PO/PPp/v37//79+u7i8cul56Vi34Qp23ML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dhnE+gcZgmPoLGMjuRDoENmRwGhINFcEijU2cSKCWbB1aKM0XuZCgELpusUhLK4fhHExbCMO0tXMgLkQ746pSOjgQ1xBqg1F1mtDI1i56BHb3oCewm4oeYS71IhHp5VABENiHRKzc6ScXi1zpRyHWHvSTi0WuDqCQawWCIINSFGLjKYDBwOvIObxZgBnMIjeGUIitEAYDbw6jEDsvQZAR5PnLXi7IwBtHUYiDQhBk7BYK2eItCHJ7HIU4+gixd0EN8rTq5CvI3hUDkNkhQLug/A4a8QujR9TKCTSyU0GPqO5yXIWHw+n71XUPbYC4CHrk/iQHAh48pD53PTJxIZGENzmLbk1xGQA8TqIsJBfjPh9Lcc9ayTTOY07yE6pCns5gGCD2Gc2ozGqe4yDghZyiEO0clgFeuhGPCpxfwDMAePWaWFkcxUUkeYTHL2h8g2sAcEpPdDSCSzg3398pLCJQYMGygQ8Cikt4Nwy+ffeelwFAadksT+ND2gBPg71FlPNSYMFH/gYAFZVh+C2DS8tkL8NV1TrMDQbOGj/hPUGtjeG0cRanGDi/OEFIsJGc0es4FfhZu4C9ztdNf01tPUQ5MKtbMyehMtjU2TQ0bsjA/NzpmX5awpyMpuaWtijVakit6rr/Zar0qxCEOYbW9o7O7m/QMvLvd+9Nmqgb9UdSTD29fVeuDl6/cXPEOHZbE3NngvCXCUck/QNS09Bw1eitcSF//okRI0bM/5sfl10eGtmsheUAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTQtMTEtMTBUMjI6NDI6MjQrMDA6MDCQj02lAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE0LTExLTEwVDIyOjQyOjI0KzAwOjAw4dL1GQAAAABJRU5ErkJggg==
"@
$iconStream=[System.IO.MemoryStream][System.Convert]::FromBase64String($iconBase64)
$iconBmp=[System.Drawing.Bitmap][System.Drawing.Image]::FromStream($iconStream)
$iconHandle=$iconBmp.GetHicon()
$icon=[System.Drawing.Icon]::FromHandle($iconHandle)
$frmServer.icon = $icon
[string] $logoBase64=@"
iVBORw0KG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/ciKzbvz5It1pnqcVZunTdhY4ZbUM9cqB2RmewQHDaBN2oDxvGyiqIvT12QgiF5a++8jN0pLnvNkdPVdzEs09nFKs9Xy9oQyknjOyYLczfu/DKZdbucffMzcPi7C+BELlJUUmkWX/DbJcbcmul11wYViLnpjgo1FCgvqwzdGsvnSkcgy7IsGIYBwzJgWBZMXW73ex/Rr+072stkJY8ksh8DiKS5HK/pYRU5qS6MHtQDgACqG+/UXKzZaLc7hvS/pdPeouKyN/1hxt01x7tPVdW/ByOMi7O0M4efn/66XeJ/aYYjKD7nQ48OaTAMWD1y3a+k2QV/itvZu2dexnhLN6Up9/xoZOdU6WhVxJgwasVbziifK1oDDcNYoQEvAAC16uIYsy6zVt5uD7WAqpChD+rRCb3Sma8AwCnyC/Jvyh55e58uKRNuvwVnfns3t2zT/q2p2UnI8kjLX5h+z96vvikdzbm8GNkrbenBU+5+5aoIM1Q1HwBN8Tjfks7V3LNo80fCB8vuR0Qzkv+28/CHXXNS8ZfH7sIHR87gth6Z4Tn/OvzAwZMXt3izxTt85yv7A9gLAP8Hj5ZTZfsLQT8AAAAASUVORK5CYII=
"@
$imageBytes = [Convert]::FromBase64String($logoBase64)
$ms = New-Object IO.MemoryStream($imageBytes, 0, $imageBytes.Length)
$ms.Write($imageBytes, 0, $imageBytes.Length);
$logo = [System.Drawing.Image]::FromStream($ms, $true)
$pictureBox = new-object Windows.Forms.PictureBox
$pictureBox.Width = 101
$pictureBox.Height = 66;
$pictureBox.Location = New-Object System.Drawing.Size(190,20)
$pictureBox.Image = $logo;
$frmServer.Controls.Add($pictureBox)
#endregion
# display the form
[System.Windows.Forms.Application]::EnableVisualStyles()
[System.Windows.Forms.Application]::Run($frmServer)
If ($continueProcessing -eq $False) {
Write-Verbose "$(Get-Date): Script cancelled by user."
Return
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# End of GUI component
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
#endregion Documentation GUI
Write-Verbose "$(Get-Date): Output directory: $($Script:OutputDir)"
Write-Verbose "$(Get-Date): Output file: $($Script:OutputFile)"
Write-Verbose "$(Get-Date): Title: $($Script:Title.Replace("`r`n"," "))"
Write-Verbose "$(Get-Date): Author: $($Script:Author)"
Write-Verbose "$(Get-Date): Doc outputs: $(iif $Script:OutputWord 'Word ' '')$(iif $Script:OutputHTML 'HTML ' '')$(iif $Script:OutputText 'Text ' '')"
Write-Verbose "$(Get-Date): Misc outputs: $(iif $Script:Software 'Software ' '')$(iif $Script:Hardware 'Hardware ' '')"
# ~~~~~~~~~~~~~ PScribo bundle ~~~~~~~~~~~~~~~
#region PScribo Bundle v0.7.21.110
#requires -Version 3
<#
The MIT License (MIT)
Copyright (c) 2018 Iain Brighton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
#>
$localized = DATA {
# en-US
ConvertFrom-StringData @'
ImportingFile = Importing file '{0}'.
InvalidDirectoryPathError = Path '{0}' is not a valid directory path.'
NoScriptBlockProvidedError = No PScribo section script block is provided (have you put the open curly brace on the next line?).
InvalidHtmlColorError = Invalid Html color '{0}' specified.
InvalidHtmlBackgroundColorError = Invalid Html background color '{0}' specified.
UndefinedTableHeaderStyleError = Undefined table header style '{0}' specified.
UndefinedTableRowStyleError = Undefined table row style '{0}' specified.
UndefinedAltTableRowStyleError = Undefined table alternating row style '{0}' specified.
InvalidTableBorderColorError = Invalid table border color '{0}' specified.
UndefinedStyleError = Undefined style '{0}' specified.
OpenPackageError = Error opening package '{0}'. Ensure the file in not in use by another process.
MaxHeadingLevelWarning = Html5 supports a maximum of 6 heading levels. Reduce the number of nested Document sections to remove the unsupported tags in the resulting Html output.
TableHeadersWithNoColumnsWarning = Table headers have been specified with no table columns/properties. Headers will be ignored.
TableHeadersCountMismatchWarning = The number of table headers specified does not match the number of specified columns/properties. Headers will be ignored.
ListTableColumnCountWarning = Table columns widths in list format must be 2. Column widths will be ignored.
TableColumnWidthMismatchWarning = The specified number of table columns and column widths do not match. Column widths will be ignored.
TableColumnWidthSumWarning = The table column widths total '{0}'%. Total column width must equal 100%. Column widths will be ignored.
TableWidthOverflowWarning = The table width overflows the page margin and has been adjusted to '{0}'%.
UnexpectedObjectWarning = Unexpected object in section '{0}'.
UnexpectedObjectTypeWarning = Unexpected object '{0}' in section '{1}'.
DocumentProcessingStarted = Document '{0}' processing started.
DocumentInvokePlugin = Invoking '{0}' plugin.
DocumentOptions = Setting global document options.
DocumentOptionSpaceSeparator = Setting default space separator to '{0}'.
DocumentOptionUppercaseHeadings = Enabling uppercase headings.
DocumentOptionUppercaseSections = Enabling uppercase sections.
DocumentOptionSectionNumbering = Enabling section/heading numbering.
DocumentOptionPageTopMargin = Setting page top margin to '{0}'mm.
DocumentOptionPageRightMargin = Setting page right margin to '{0}'mm.
DocumentOptionPageBottomMargin = Setting page bottom margin to '{0}'mm.
DocumentOptionPageLeftMargin = Setting page left margin to '{0}'mm.
DocumentOptionPageSize = Setting page size to '{0}'.
DocumentOptionPageOrientation = Setting page orientation to '{0}'.
DocumentOptionPageHeight = Setting page height to '{0}'mm.
DocumentOptionPageWidth = Setting page width to '{0}'mm.
DocumentOptionDefaultFont = Setting default font(s) to '{0}'.
ProcessingBlankLine = Processing blank line.
ProcessingImage = Processing image '{0}'.
ProcessingLineBreak = Processing line break.
ProcessingPageBreak = Processing page break.
ProcessingParagraph = Processing paragraph '{0}'.
ProcessingSection = Processing section '{0}'.
ProcessingSectionStarted = Processing section '{0}' started.
ProcessingSectionCompleted = Processing section '{0}' completed.
PluginProcessingSection = Processing {0} '{1}'.
ProcessingStyle = Setting document style '{0}'.
ProcessingTable = Processing table '{0}'.
ProcessingTableStyle = Setting table style '{0}'.
ProcessingTOC = Processing table of contents '{0}'.
ProcessingDocumentPart = Processing document part '{0}'.
WritingDocumentPart = Writing document part '{0}'.
GeneratingPackageRelationships = Generating package relationships.
PluginUnsupportedSection = Unsupported section '{0}'.
DocumentProcessingCompleted = Document '{0}' processing completed.
TotalProcessingTime = Total processing time '{0:N2}' seconds.
SavingFile = Saving file '{0}'.
IncorrectCharsInPath = The incorrect char found in the Path.
IncorrectCharsInName = The incorrect char found in the Name.
'@;
}
function BlankLine {
<#
.SYNOPSIS
Initializes a new PScribo blank line object.
#>
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline, Position = 0)]
[System.UInt32] $Count = 1
)
begin {
#region BlankLine Private Functions
function New-PScriboBlankLine {
<#
.SYNOPSIS
Initializes a new PScribo blank line break.
.NOTES
This is an internal function and should not be called directly.
#>
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions','')]
[OutputType([System.Management.Automation.PSCustomObject])]
param (
[Parameter(ValueFromPipeline)]
[System.UInt32] $Count = 1
)
process {
$typeName = 'PScribo.BlankLine';
$pscriboDocument.Properties['BlankLines']++;
$pscriboBlankLine = [PSCustomObject] @{
Id = [System.Guid]::NewGuid().ToString();
LineCount = $Count;
Type = $typeName;
}
return $pscriboBlankLine;
}
} #end function New-PScriboBlankLine
#endregion BlankLine Private Functions
} #end begin
process {
WriteLog -Message $localized.ProcessingBlankLine;
return (New-PScriboBlankLine @PSBoundParameters);
} #end process
} #end function BlankLine
function Document {
<#
.SYNOPSIS
Initializes a new PScribo document object.
#>
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments','pluginName')]
[OutputType([System.Management.Automation.PSCustomObject])]
param (
## PScribo document name
[Parameter(Mandatory, Position = 0)]
[System.String] $Name,
## PScribo document DSL script block containing Section, Paragraph and/or Table etc. commands.
[Parameter(Position = 1)]
[System.Management.Automation.ScriptBlock] $ScriptBlock = $(throw $localized.NoScriptBlockProvidedError),
## PScribo document Id
[Parameter()]
[System.String] $Id = $Name.Replace(' ','')
)
begin {
$pluginName = 'Document';
#region Document Private Functions
function New-PScriboDocument {
<#
.SYNOPSIS
Initializes a new PScript document object.
.NOTES
This is an internal function and should not be called directly.
#>
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions','')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseLiteralInitializerForHashtable','')]
[OutputType([System.Management.Automation.PSCustomObject])]
param (
## PScribo document name
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[System.String] $Name,
## PScribo document Id
[Parameter()]
[ValidateNotNullOrEmpty()]
[System.String] $Id = $Name.Replace(' ','')
)
begin {
if ($(Test-CharsInPath -Path $Name -SkipCheckCharsInFolderPart) -eq 3 ) {
throw -Message ($localized.IncorrectCharsInName);
}
}
process {
WriteLog -Message ($localized.DocumentProcessingStarted -f $Name);
$typeName = 'PScribo.Document';
$pscriboDocument = [PSCustomObject] @{
Id = $Id.ToUpper();
Type = $typeName;
Name = $Name;
Sections = New-Object -TypeName System.Collections.ArrayList;
Options = New-Object -TypeName System.Collections.Hashtable([System.StringComparer]::InvariantCultureIgnoreCase);
Properties = New-Object -TypeName System.Collections.Hashtable([System.StringComparer]::InvariantCultureIgnoreCase);
Styles = New-Object -TypeName System.Collections.Hashtable([System.StringComparer]::InvariantCultureIgnoreCase);
TableStyles = New-Object -TypeName System.Collections.Hashtable([System.StringComparer]::InvariantCultureIgnoreCase);
DefaultStyle = $null;
DefaultTableStyle = $null;
TOC = New-Object -TypeName System.Collections.ArrayList;
}
$defaultDocumentOptionParams = @{
MarginTopAndBottom = 72;
MarginLeftAndRight = 54;
PageSize = 'A4';
DefaultFont = 'Calibri','Candara','Segoe','Segoe UI','Optima','Arial','Sans-Serif';
}
DocumentOption @defaultDocumentOptionParams -Verbose:$false;
## Set "default" styles
Style -Name Normal -Default -Verbose:$false;
Style -Name Title -Size 28 -Color 0072af -Verbose:$false;
Style -Name TOC -Size 16 -Color 0072af -Hide -Verbose:$false;
Style -Name 'Heading 1' -Size 16 -Color 0072af -Verbose:$false;
Style -Name 'Heading 2' -Size 14 -Color 0072af -Verbose:$false;
Style -Name 'Heading 3' -Size 12 -Color 0072af -Verbose:$false;
Style -Name 'Heading 4' -Size 11 -Color 2f5496 -Italic -Verbose:$false;
Style -Name 'Heading 5' -Size 11 -Color 2f5496 -Verbose:$false;
Style -Name 'Heading 6' -Size 11 -Color 1f3763 -Verbose:$false;
Style -Name TableDefaultHeading -Size 11 -Color fff -Bold -BackgroundColor 4472c4 -Verbose:$false;
Style -Name TableDefaultRow -Size 11 -Verbose:$false;
Style -Name TableDefaultAltRow -BackgroundColor d0ddee -Verbose:$false;
Style -Name Footer -Size 8 -Color 0072af -Hide -Verbose:$false;
TableStyle TableDefault -BorderWidth 1 -BorderColor 2a70be -HeaderStyle TableDefaultHeading -RowStyle TableDefaultRow -AlternateRowStyle TableDefaultAltRow -Default -Verbose:$false;
return $pscriboDocument;
} #end process
} #end function NewPScriboDocument
function Invoke-PScriboSection {
<#
.SYNOPSIS
Processes the document/TOC section versioning each level, i.e. 1.2.2.3
.NOTES
This is an internal function and should not be called directly.
#>
[CmdletBinding()]
param ( )
function Invoke-PScriboSectionLevel {
<#
.SYNOPSIS
Nested function that processes each document/TOC nested section
#>
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[ValidateNotNull()]
[PSCustomObject] $Section,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[System.String] $Number
)
if ($pscriboDocument.Options['ForceUppercaseSection']) {
$Section.Name = $Section.Name.ToUpper();
}
## Set this section's level
$Section.Number = $Number;
$Section.Level = $Number.Split('.').Count -1;
### Add to the TOC
$tocEntry = [PScustomObject] @{ Id = $Section.Id; Number = $Number; Level = $Section.Level; Name = $Section.Name; }
[ref] $null = $pscriboDocument.TOC.Add($tocEntry);
## Set sub-section level seed
$minorNumber = 1;
foreach ($s in $Section.Sections) {
if ($s.Type -like '*.Section' -and -not $s.IsExcluded) {
$sectionNumber = ('{0}.{1}' -f $Number, $minorNumber).TrimStart('.'); ## Calculate section version
Invoke-PScriboSectionLevel -Section $s -Number $sectionNumber;
$minorNumber++;
}
} #end foreach section
} #end function Invoke-PScriboSectionLevel
$majorNumber = 1;
foreach ($s in $pscriboDocument.Sections) {
if ($s.Type -like '*.Section') {
if ($pscriboDocument.Options['ForceUppercaseSection']) {
$s.Name = $s.Name.ToUpper();
}
if (-not $s.IsExcluded) {
Invoke-PScriboSectionLevel -Section $s -Number $majorNumber;
$majorNumber++;
}
} #end if
} #end foreach
} #end function Invoke-PSScriboSection
#endregion Document Private Functions
} #end begin
process {
$stopwatch = [Diagnostics.Stopwatch]::StartNew();
$pscriboDocument = New-PScriboDocument -Name $Name -Id $Id;
## Call the Document script block
foreach ($result in & $ScriptBlock) {
[ref] $null = $pscriboDocument.Sections.Add($result);
}
Invoke-PScriboSection;
WriteLog -Message ($localized.DocumentProcessingCompleted -f $pscriboDocument.Name);
$stopwatch.Stop();
WriteLog -Message ($localized.TotalProcessingTime -f $stopwatch.Elapsed.TotalSeconds);
return $pscriboDocument;
} #end process
} #end function Document
function DocumentOption {
<#
.SYNOPSIS
Initializes a new PScribo global/document options/settings.
.NOTES
Options are reset upon each invocation.
#>
[CmdletBinding(DefaultParameterSetName = 'Margin')]
[Alias('GlobalOption')]
param (
## Forces document header to be displayed in upper case.
[Parameter(ValueFromPipelineByPropertyName)]
[System.Management.Automation.SwitchParameter] $ForceUppercaseHeader,
## Forces all section headers to be displayed in upper case.
[Parameter(ValueFromPipelineByPropertyName)]
[System.Management.Automation.SwitchParameter] $ForceUppercaseSection,
## Enable section/heading numbering
[Parameter(ValueFromPipelineByPropertyName)]
[System.Management.Automation.SwitchParameter] $EnableSectionNumbering,
## Default space replacement separator
[Parameter(ValueFromPipelineByPropertyName)]
[Alias('Separator')]
[AllowNull()]
[ValidateLength(0,1)]
[System.String] $SpaceSeparator,
## Default page top, bottom, left and right margin (pt)
[Parameter(ValueFromPipelineByPropertyName, ParameterSetName = 'Margin')]
[System.UInt16] $Margin = 72,
## Default page top and bottom margins (pt)
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = 'CustomMargin')]
[System.UInt16] $MarginTopAndBottom,
## Default page left and right margins (pt)
[Parameter(Mandatory, ValueFromPipelineByPropertyName, ParameterSetName = 'CustomMargin')]
[System.UInt16] $MarginLeftAndRight,
## Default page size
[Parameter(ValueFromPipelineByPropertyName)]
[ValidateSet('A4','Legal','Letter')]
[System.String] $PageSize = 'A4',
## Page orientation
[Parameter(ValueFromPipelineByPropertyName)]
[ValidateSet('Portrait','Landscape')]
[System.String] $Orientation = 'Portrait',
## Default document font(s)
[Parameter(ValueFromPipelineByPropertyName)]
[System.String[]] $DefaultFont = @('Calibri','Candara','Segoe','Segoe UI','Optima','Arial','Sans-Serif')
)
process {
$localized.DocumentOptions | WriteLog;
if ($SpaceSeparator) {
WriteLog -Message ($localized.DocumentOptionSpaceSeparator -f $SpaceSeparator);
$pscriboDocument.Options['SpaceSeparator'] = $SpaceSeparator;
}
if ($ForceUppercaseHeader) {
$localized.DocumentOptionUppercaseHeadings | WriteLog;
$pscriboDocument.Options['ForceUppercaseHeader'] = $true;
$pscriboDocument.Name = $pscriboDocument.Name.ToUpper();
} #end if ForceUppercaseHeader
if ($ForceUppercaseSection) {
$localized.DocumentOptionUppercaseSections | WriteLog;
$pscriboDocument.Options['ForceUppercaseSection'] = $true;
} #end if ForceUppercaseSection
if ($EnableSectionNumbering) {
$localized.DocumentOptionSectionNumbering | WriteLog;
$pscriboDocument.Options['EnableSectionNumbering'] = $true;
}
if ($DefaultFont) {
WriteLog -Message ($localized.DocumentOptionDefaultFont -f ([System.String]::Join(', ', $DefaultFont)));
$pscriboDocument.Options['DefaultFont'] = $DefaultFont;
}
if ($PSCmdlet.ParameterSetName -eq 'CustomMargin') {
if ($MarginTopAndBottom -eq 0) { $MarginTopAndBottom = 72; }
if ($MarginLeftAndRight -eq 0) { $MarginTopAndBottom = 72; }
$pscriboDocument.Options['MarginTop'] = ConvertPtToMm -Point $MarginTopAndBottom;
$pscriboDocument.Options['MarginBottom'] = $pscriboDocument.Options['MarginTop'];
$pscriboDocument.Options['MarginLeft'] = ConvertPtToMm -Point $MarginLeftAndRight;
$pscriboDocument.Options['MarginRight'] = $pscriboDocument.Options['MarginLeft'];
}
else {
$pscriboDocument.Options['MarginTop'] = ConvertPtToMm -Point $Margin;
$pscriboDocument.Options['MarginBottom'] = $pscriboDocument.Options['MarginTop'];
$pscriboDocument.Options['MarginLeft'] = $pscriboDocument.Options['MarginTop'];
$pscriboDocument.Options['MarginRight'] = $pscriboDocument.Options['MarginTop'];
}
WriteLog -Message ($localized.DocumentOptionPageTopMargin -f $pscriboDocument.Options['MarginTop']);
WriteLog -Message ($localized.DocumentOptionPageRightMargin -f $pscriboDocument.Options['MarginRight']);
WriteLog -Message ($localized.DocumentOptionPageBottomMargin -f $pscriboDocument.Options['MarginBottom']);
WriteLog -Message ($localized.DocumentOptionPageLeftMargin -f $pscriboDocument.Options['MarginLeft']);
## Convert page size
($localized.DocumentOptionPageSize -f $PageSize) | WriteLog;
switch ($PageSize) {
'A4' {
$pscriboDocument.Options['PageWidth'] = 210.0;
$pscriboDocument.Options['PageHeight'] = 297.0;
}
'Legal' {
$pscriboDocument.Options['PageWidth'] = 215.9;
$pscriboDocument.Options['PageHeight'] = 355.6;
}
'Letter' {
$pscriboDocument.Options['PageWidth'] = 215.9;
$pscriboDocument.Options['PageHeight'] = 279.4;
}
} #end switch
## Convert page size
($localized.DocumentOptionPageOrientation -f $Orientation) | WriteLog;
if ($Orientation -eq 'Landscape') {
## Swap the height/width measurements
$pageHeight = $pscriboDocument.Options['PageHeight'];
$pscriboDocument.Options['PageHeight'] = $pscriboDocument.Options['PageWidth'];
$pscriboDocument.Options['PageWidth'] = $pageHeight;
}
($localized.DocumentOptionPageHeight -f $pscriboDocument.Options['PageHeight']) | WriteLog;
($localized.DocumentOptionPageWidth -f $pscriboDocument.Options['PageWidth']) | WriteLog;