Skip to content

Commit 4ec7da2

Browse files
authored
Merge pull request #24 from AsBuiltReport/dev
v0.5.3 public release
2 parents 25d125d + daf93bc commit 4ec7da2

14 files changed

+1655
-696
lines changed

.github/workflows/Release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ jobs:
1313
shell: pwsh
1414
run: |
1515
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
16+
- name: Install DBAtools module
17+
shell: pwsh
18+
run: |
19+
Install-Module -Name dbatools -Repository PSGallery -Force
1620
- name: Install AsBuiltReport.Core module
1721
shell: pwsh
1822
run: |

AsBuiltReport.Microsoft.Windows.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
"ShowHeaderFooter": true,
99
"ShowTableCaptions": true
1010
},
11-
"Options": {},
11+
"Options": {
12+
"SQLLogin": false,
13+
"SQLUserName": "",
14+
"SQLSecurePassword": ""
15+
},
1216
"InfoLevel": {
1317
"_comment_": "Please refer to the AsBuiltReport project contributing guide for information about how to define InfoLevels.",
1418
"_comment_": "0 = Disabled, 1 = Enabled, 2 = Adv Summary, 3 = Detailed, 4 = Adv Detailed, 5 = Comprehensive",
@@ -22,7 +26,8 @@
2226
"SMB": 1,
2327
"DHCP": 1,
2428
"DNS": 1,
25-
"FailOverCluster": 1
29+
"FailOverCluster": 1,
30+
"SQLServer": 1
2631
},
2732
"HealthCheck": {
2833
"Networking": {
@@ -52,6 +57,9 @@
5257
},
5358
"SMB": {
5459
"BP": true
60+
},
61+
"SQLServer": {
62+
"BP": true
5563
}
5664
}
5765
}

AsBuiltReport.Microsoft.Windows.psd1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'AsBuiltReport.Microsoft.Windows.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.5.2'
15+
ModuleVersion = '0.5.3'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -55,6 +55,10 @@
5555
@{
5656
ModuleName = 'AsBuiltReport.Core';
5757
ModuleVersion = '1.3.0'
58+
},
59+
@{
60+
ModuleName = 'dbatools';
61+
ModuleVersion = '2.1.7'
5862
}
5963
)
6064

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.5.3] - 2024-03-06
9+
10+
### Added
11+
12+
- Add SQL Server support
13+
- General Information
14+
- Security
15+
- Login
16+
- Roles
17+
- Databases
18+
- User
19+
- System
20+
- Server Objects
21+
- Backup Devices
22+
823
## [0.5.2] - 2024-02-18
924

1025
### Added

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ PowerShell 5.1 and the following PowerShell modules are required for generating
7272
- [DhcpServer Module](https://docs.microsoft.com/en-us/powershell/module/dhcpserver/?view=windowsserver2019-ps)
7373
- [DnsServer Module](https://docs.microsoft.com/en-us/powershell/module/dnsserver/?view=windowsserver2019-ps)
7474
- [FailoverClusters Module](https://learn.microsoft.com/en-us/powershell/module/failoverclusters/?view=windowsserver2022-ps)
75+
- [DBATools Module](https://dbatools.io/)
76+
7577

7678
### Linux & macOS
7779

@@ -97,13 +99,15 @@ Install-WindowsFeature -Name RSAT-DHCP
9799
# Hyper-V Server powershell modules
98100
Install-WindowsFeature -Name Hyper-V-PowerShell
99101
100-
#IIS Server powershell modules
102+
# IIS Server powershell modules
101103
Install-WindowsFeature -Name web-mgmt-console
102104
Install-WindowsFeature -Name Web-Scripting-Tools
103105
104-
#FailOver Cluster powershell modules
106+
# FailOver Cluster powershell modules
105107
Install-WindowsFeature -Name RSAT-Clustering-PowerShell
106108
109+
# DBATools for SQL
110+
Install-Module dbatools
107111
```
108112

109113
### PowerShell v5.x running on Windows client computer (Target)
@@ -126,6 +130,8 @@ Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole
126130
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerManagementTools
127131
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementScriptingTools
128132
133+
# DBATools for SQL
134+
Install-Module dbatools
129135
```
130136

131137
### GitHub
@@ -179,6 +185,23 @@ The **Report** schema provides configuration of the Microsoft Windows report inf
179185

180186
The **Options** schema allows certain options within the report to be toggled on or off.
181187

188+
| Sub-Schema | Setting | Default | Description |
189+
| ----------------- | ------------ | ------- | ---------------------------------------- |
190+
| SQLLogin | true / false | false | Enable sql server login authentication . |
191+
| SQLUserName | User defined | empty | Sql server login Username . |
192+
| SQLSecurePassword | User defined | empty | Sql server login SecureString Password . |
193+
194+
#### Generating a SecureString
195+
196+
```powershell
197+
PS C:\> "SecurePassword" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString
198+
01000000d08c9ddf0115d1118c7a00c04fc297eb01000000b3605317d738c346801fbff6596b0d130000
199+
PS C:\>
200+
```
201+
Copy/Paste the output text to the variable SQLSecurePassword
202+
203+
##### Note: Storing any credential in a file can pose a security risk. Use this option at your own risk!
204+
182205
### InfoLevel
183206

184207
The **InfoLevel** schema allows configuration of each section of the report at a granular level. The following sections can be set.
@@ -204,6 +227,7 @@ The table below outlines the default and maximum **InfoLevel** settings for each
204227
| DHCP | 1 | 2 |
205228
| DNS | 1 | 2 |
206229
| FailOverCluster | 1 | 2 |
230+
| SQLServer | 1 | 2 |
207231

208232
### Healthcheck
209233

Samples/Sample Microsoft Windows As Built Report.html

Lines changed: 977 additions & 680 deletions
Large diffs are not rendered by default.
Binary file not shown.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
function Get-AbrWinSQLBackupDevice {
2+
<#
3+
.SYNOPSIS
4+
Used by As Built Report to retrieve Windows SQL Server backup device information.
5+
.DESCRIPTION
6+
Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo.
7+
.NOTES
8+
Version: 0.5.3
9+
Author: Jonathan Colon
10+
Twitter: @rebelinux
11+
Github: AsBuiltReport
12+
Credits: Iain Brighton (@iainbrighton) - PScribo module
13+
14+
.LINK
15+
https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows
16+
#>
17+
[CmdletBinding()]
18+
param (
19+
)
20+
21+
begin {
22+
Write-PScriboMessage "SQL Server Backup Device InfoLevel set at $($InfoLevel.SQLServer)."
23+
}
24+
25+
process {
26+
try {
27+
Write-PScriboMessage "Collecting SQL Server Backup Device information."
28+
$SQLBackUpDevices = Get-DbaBackupDevice -SqlInstance $SQLServer | Sort-Object -Property Name
29+
if ($SQLBackUpDevices) {
30+
Write-PScriboMessage "Collecting SQL Server Backup Device information."
31+
Section -Style Heading4 'Backup Device' {
32+
$ItemInfo = @()
33+
foreach ($Item in $SQLBackUpDevices) {
34+
try {
35+
$InObj = [Ordered]@{
36+
'Name' = $Item.Name
37+
'Backup Device Type' = $Item.BackupDeviceType
38+
'Physical Location' = $Item.PhysicalLocation
39+
'Skip Tape Label' = ConvertTo-TextYN $Item.SkipTapeLabel
40+
}
41+
$ItemInfo += [PSCustomObject]$InObj
42+
} catch {
43+
Write-PScriboMessage -IsWarning "SQL Server System Backup Device Section: $($_.Exception.Message)"
44+
}
45+
}
46+
47+
if ($InfoLevel.SQLServer -ge 2) {
48+
Paragraph "The following sections detail the configuration of the backup device."
49+
foreach ($Item in $ItemInfo) {
50+
Section -Style NOTOCHeading5 -ExcludeFromTOC "$($Item.Name)" {
51+
$TableParams = @{
52+
Name = "Backup Device - $($Item.Name)"
53+
List = $true
54+
ColumnWidths = 50, 50
55+
}
56+
if ($Report.ShowTableCaptions) {
57+
$TableParams['Caption'] = "- $($TableParams.Name)"
58+
}
59+
$Item | Table @TableParams
60+
}
61+
}
62+
} else {
63+
Paragraph "The following table summarises the configuration of the backup device."
64+
BlankLine
65+
$TableParams = @{
66+
Name = "Backup Devices"
67+
List = $false
68+
Columns = 'Name', 'Backup Device Type', 'Physical Location'
69+
ColumnWidths = 25, 25, 50
70+
}
71+
if ($Report.ShowTableCaptions) {
72+
$TableParams['Caption'] = "- $($TableParams.Name)"
73+
}
74+
$ItemInfo | Table @TableParams
75+
}
76+
}
77+
}
78+
} catch {
79+
Write-PScriboMessage -IsWarning "SQL Server Backup Device Section: $($_.Exception.Message)"
80+
}
81+
}
82+
end {}
83+
}

Src/Private/Get-AbrWinSQLBuild.ps1

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
function Get-AbrWinSQLBuild {
2+
<#
3+
.SYNOPSIS
4+
Used by As Built Report to retrieve Windows SQL Server Properties information.
5+
.DESCRIPTION
6+
Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo.
7+
.NOTES
8+
Version: 0.5.2
9+
Author: Andrew Ramsay
10+
Editor: Jonathan Colon
11+
Twitter: @asbuiltreport
12+
Github: AsBuiltReport
13+
Credits: Iain Brighton (@iainbrighton) - PScribo module
14+
15+
.LINK
16+
https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows
17+
#>
18+
[CmdletBinding()]
19+
param (
20+
)
21+
22+
begin {
23+
Write-PScriboMessage "SQL Server InfoLevel set at $($InfoLevel.SQLServer)."
24+
Write-PScriboMessage "Collecting SQL Server Properties information."
25+
}
26+
27+
process {
28+
if ($InfoLevel.SQLServer -ge 1) {
29+
try {
30+
$Properties = Get-DbaInstanceProperty -SqlInstance $SQLServer | ForEach-Object { @{$_.Name = $_.Value } }
31+
$Build = Get-DbaBuild -SqlInstance $SQLServer -WarningAction SilentlyContinue
32+
if ($Properties) {
33+
Section -Style Heading3 'General Information' {
34+
Paragraph 'The following table details sql server Properties information'
35+
BlankLine
36+
[array]$SQLServerObjt = @()
37+
$TempSQLServerObjt = [PSCustomObject]@{
38+
'Instance Name' = $Build.SqlInstance
39+
'Fully Qualified Net Name' = $Properties.FullyQualifiedNetName
40+
'Supported Until' = $Build.SupportedUntil.ToShortDateString()
41+
'Edition' = $Properties.Edition
42+
'Level' = "Microsoft SQL Server $($Build.NameLevel)"
43+
'Build' = $Properties.VersionString
44+
'Service Pack' = $Properties.ProductLevel
45+
'Comulative Update' = ConvertTo-EmptyToFiller $Build.CULevel
46+
'KB Level' = $Build.KBLevel
47+
'Case Sensitive' = ConvertTo-TextYN $Properties.IsCaseSensitive
48+
'Full Text Installed' = ConvertTo-TextYN $Properties.IsFullTextInstalled
49+
'XTP Supported' = ConvertTo-TextYN $Properties.IsXTPSupported
50+
'Clustered' = ConvertTo-TextYN $Properties.IsClustered
51+
'Single User' = ConvertTo-TextYN $Properties.IsSingleUser
52+
'Language' = $Properties.Language
53+
'Collation' = $Properties.Collation
54+
'Sql CharSet Name' = $Properties.SqlCharSetName
55+
'Root Directory' = $Properties.RootDirectory
56+
'Master DB Path' = $Properties.MasterDBPath
57+
'Master DB Log Path' = $Properties.MasterDBLogPath
58+
'Backup Directory' = $Properties.BackupDirectory
59+
'Default File' = $Properties.DefaultFile
60+
'Default Log' = $Properties.DefaultLog
61+
'Login Mode' = $Properties.LoginMode
62+
'Mail Profile' = ConvertTo-EmptyToFiller $Properties.MailProfile
63+
'Warning' = ConvertTo-EmptyToFiller $Build.Warning
64+
}
65+
$SQLServerObjt += $TempSQLServerObjt
66+
67+
$TableParams = @{
68+
Name = "General Information"
69+
List = $True
70+
ColumnWidths = 40, 60
71+
}
72+
if ($Report.ShowTableCaptions) {
73+
$TableParams['Caption'] = "- $($TableParams.Name)"
74+
}
75+
$SQLServerObjt | Table @TableParams
76+
}
77+
}
78+
} catch {
79+
Write-PScriboMessage -IsWarning $_.Exception.Message
80+
}
81+
}
82+
}
83+
end {}
84+
}

0 commit comments

Comments
 (0)