-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAD-Snapshot-GUI-Output.ps1
More file actions
144 lines (125 loc) · 6.94 KB
/
AD-Snapshot-GUI-Output.ps1
File metadata and controls
144 lines (125 loc) · 6.94 KB
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
#region Output Options Tab
# Create File Options Group Box
$grpFileOptions = New-Object System.Windows.Forms.GroupBox
$grpFileOptions.Text = "File Options"
$grpFileOptions.Location = New-Object System.Drawing.Point(10, 20)
$grpFileOptions.Size = New-Object System.Drawing.Size(740, 150)
$tabOutput.Controls.Add($grpFileOptions)
# Create File
$chkCreateFile = New-Object System.Windows.Forms.CheckBox
$chkCreateFile.Text = "Save Report as File"
$chkCreateFile.Location = New-Object System.Drawing.Point(20, 25)
$chkCreateFile.Size = New-Object System.Drawing.Size(200, 20)
$chkCreateFile.Checked = $true
$toolTip.SetToolTip($chkCreateFile, "When checked, the report will be saved as an HTML file. This is recommended for sortable user and computer lists.")
$grpFileOptions.Controls.Add($chkCreateFile)
# Output Path
$lblOutputPath = New-Object System.Windows.Forms.Label
$lblOutputPath.Text = "Output Path (blank = Desktop):"
$lblOutputPath.Location = New-Object System.Drawing.Point(20, 55)
$lblOutputPath.Size = New-Object System.Drawing.Size(200, 20)
$grpFileOptions.Controls.Add($lblOutputPath)
$txtOutputPath = New-Object System.Windows.Forms.TextBox
$txtOutputPath.Location = New-Object System.Drawing.Point(220, 55)
$txtOutputPath.Size = New-Object System.Drawing.Size(400, 20)
$toolTip.SetToolTip($txtOutputPath, "Specify the folder where reports will be saved. If left blank, reports will be saved to your desktop.")
$grpFileOptions.Controls.Add($txtOutputPath)
$btnBrowseOutputPath = New-Object System.Windows.Forms.Button
$btnBrowseOutputPath.Text = "..."
$btnBrowseOutputPath.Location = New-Object System.Drawing.Point(630, 55)
$btnBrowseOutputPath.Size = New-Object System.Drawing.Size(30, 20)
$grpFileOptions.Controls.Add($btnBrowseOutputPath)
# PDF Options
$chkWantPDFFile = New-Object System.Windows.Forms.CheckBox
$chkWantPDFFile.Text = "Create PDF Report"
$chkWantPDFFile.Location = New-Object System.Drawing.Point(20, 85)
$chkWantPDFFile.Size = New-Object System.Drawing.Size(200, 20)
$chkWantPDFFile.Checked = $false
$toolTip.SetToolTip($chkWantPDFFile, "When checked, a PDF version of the report will be created. Requires wkhtmltopdf to be installed.")
$grpFileOptions.Controls.Add($chkWantPDFFile)
# PDF Converter Path
$lblPDFConverter = New-Object System.Windows.Forms.Label
$lblPDFConverter.Text = "PDF Converter Path:"
$lblPDFConverter.Location = New-Object System.Drawing.Point(20, 115)
$lblPDFConverter.Size = New-Object System.Drawing.Size(200, 20)
$grpFileOptions.Controls.Add($lblPDFConverter)
$txtPDFConverter = New-Object System.Windows.Forms.TextBox
$txtPDFConverter.Location = New-Object System.Drawing.Point(220, 115)
$txtPDFConverter.Size = New-Object System.Drawing.Size(400, 20)
$txtPDFConverter.Text = "c:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"
$toolTip.SetToolTip($txtPDFConverter, "Path to the wkhtmltopdf executable. Required for PDF generation. Download from http://wkhtmltopdf.org/downloads.html")
$grpFileOptions.Controls.Add($txtPDFConverter)
$btnBrowsePDFConverter = New-Object System.Windows.Forms.Button
$btnBrowsePDFConverter.Text = "..."
$btnBrowsePDFConverter.Location = New-Object System.Drawing.Point(630, 115)
$btnBrowsePDFConverter.Size = New-Object System.Drawing.Size(30, 20)
$grpFileOptions.Controls.Add($btnBrowsePDFConverter)
# Email Options Group Box
$grpEmailOptions = New-Object System.Windows.Forms.GroupBox
$grpEmailOptions.Text = "Email Options"
$grpEmailOptions.Location = New-Object System.Drawing.Point(10, 180)
$grpEmailOptions.Size = New-Object System.Drawing.Size(740, 200)
$tabOutput.Controls.Add($grpEmailOptions)
# Send Email
$chkSendEmail = New-Object System.Windows.Forms.CheckBox
$chkSendEmail.Text = "Send Email Report"
$chkSendEmail.Location = New-Object System.Drawing.Point(20, 25)
$chkSendEmail.Size = New-Object System.Drawing.Size(200, 20)
$chkSendEmail.Checked = $false
$toolTip.SetToolTip($chkSendEmail, "When checked, the report will be emailed to the specified recipients.")
$grpEmailOptions.Controls.Add($chkSendEmail)
# From Email
$lblFromEmail = New-Object System.Windows.Forms.Label
$lblFromEmail.Text = "From Email:"
$lblFromEmail.Location = New-Object System.Drawing.Point(20, 55)
$lblFromEmail.Size = New-Object System.Drawing.Size(200, 20)
$grpEmailOptions.Controls.Add($lblFromEmail)
$txtFromEmail = New-Object System.Windows.Forms.TextBox
$txtFromEmail.Location = New-Object System.Drawing.Point(220, 55)
$txtFromEmail.Size = New-Object System.Drawing.Size(400, 20)
$txtFromEmail.Text = "user1@example.com"
$toolTip.SetToolTip($txtFromEmail, "The email address that will appear as the sender of the report.")
$grpEmailOptions.Controls.Add($txtFromEmail)
# To Email
$lblToEmail = New-Object System.Windows.Forms.Label
$lblToEmail.Text = "To Email:"
$lblToEmail.Location = New-Object System.Drawing.Point(20, 85)
$lblToEmail.Size = New-Object System.Drawing.Size(200, 20)
$grpEmailOptions.Controls.Add($lblToEmail)
$txtToEmail = New-Object System.Windows.Forms.TextBox
$txtToEmail.Location = New-Object System.Drawing.Point(220, 85)
$txtToEmail.Size = New-Object System.Drawing.Size(400, 20)
$txtToEmail.Text = "user2@example.com"
$toolTip.SetToolTip($txtToEmail, "The primary recipient email address for the report.")
$grpEmailOptions.Controls.Add($txtToEmail)
# CC List
$lblCcList = New-Object System.Windows.Forms.Label
$lblCcList.Text = "CC List (comma separated):"
$lblCcList.Location = New-Object System.Drawing.Point(20, 115)
$lblCcList.Size = New-Object System.Drawing.Size(200, 20)
$grpEmailOptions.Controls.Add($lblCcList)
$txtCcList = New-Object System.Windows.Forms.TextBox
$txtCcList.Location = New-Object System.Drawing.Point(220, 115)
$txtCcList.Size = New-Object System.Drawing.Size(400, 20)
$toolTip.SetToolTip($txtCcList, "Additional recipients for the report email. For multiple recipients, use comma-separated email addresses.")
$grpEmailOptions.Controls.Add($txtCcList)
# SMTP Server
$lblSmtpServer = New-Object System.Windows.Forms.Label
$lblSmtpServer.Text = "SMTP Server:"
$lblSmtpServer.Location = New-Object System.Drawing.Point(20, 145)
$lblSmtpServer.Size = New-Object System.Drawing.Size(200, 20)
$grpEmailOptions.Controls.Add($lblSmtpServer)
$txtSmtpServer = New-Object System.Windows.Forms.TextBox
$txtSmtpServer.Location = New-Object System.Drawing.Point(220, 145)
$txtSmtpServer.Size = New-Object System.Drawing.Size(400, 20)
$txtSmtpServer.Text = "smtp.example.org"
$toolTip.SetToolTip($txtSmtpServer, "The SMTP server that will be used to send the email report. Example: smtp.office365.com")
$grpEmailOptions.Controls.Add($txtSmtpServer)
# Attach PDF to Email
$chkAttachPDF = New-Object System.Windows.Forms.CheckBox
$chkAttachPDF.Text = "Attach PDF to Email (requires PDF option enabled)"
$chkAttachPDF.Location = New-Object System.Drawing.Point(20, 175)
$chkAttachPDF.Size = New-Object System.Drawing.Size(350, 20)
$chkAttachPDF.Checked = $false
$toolTip.SetToolTip($chkAttachPDF, "When checked, the PDF report will be attached to the email. Requires the 'Create PDF Report' option to be enabled.")
$grpEmailOptions.Controls.Add($chkAttachPDF)