Skip to content

Commit

Permalink
Merge pull request #24 from AsBuiltReport/dev
Browse files Browse the repository at this point in the history
v0.5.3 public release
  • Loading branch information
rebelinux committed Mar 6, 2024
2 parents 25d125d + daf93bc commit 4ec7da2
Show file tree
Hide file tree
Showing 14 changed files with 1,655 additions and 696 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
shell: pwsh
run: |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
- name: Install DBAtools module
shell: pwsh
run: |
Install-Module -Name dbatools -Repository PSGallery -Force
- name: Install AsBuiltReport.Core module
shell: pwsh
run: |
Expand Down
12 changes: 10 additions & 2 deletions AsBuiltReport.Microsoft.Windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
"ShowHeaderFooter": true,
"ShowTableCaptions": true
},
"Options": {},
"Options": {
"SQLLogin": false,
"SQLUserName": "",
"SQLSecurePassword": ""
},
"InfoLevel": {
"_comment_": "Please refer to the AsBuiltReport project contributing guide for information about how to define InfoLevels.",
"_comment_": "0 = Disabled, 1 = Enabled, 2 = Adv Summary, 3 = Detailed, 4 = Adv Detailed, 5 = Comprehensive",
Expand All @@ -22,7 +26,8 @@
"SMB": 1,
"DHCP": 1,
"DNS": 1,
"FailOverCluster": 1
"FailOverCluster": 1,
"SQLServer": 1
},
"HealthCheck": {
"Networking": {
Expand Down Expand Up @@ -52,6 +57,9 @@
},
"SMB": {
"BP": true
},
"SQLServer": {
"BP": true
}
}
}
6 changes: 5 additions & 1 deletion AsBuiltReport.Microsoft.Windows.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'AsBuiltReport.Microsoft.Windows.psm1'

# Version number of this module.
ModuleVersion = '0.5.2'
ModuleVersion = '0.5.3'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -55,6 +55,10 @@
@{
ModuleName = 'AsBuiltReport.Core';
ModuleVersion = '1.3.0'
},
@{
ModuleName = 'dbatools';
ModuleVersion = '2.1.7'
}
)

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

## [0.5.3] - 2024-03-06

### Added

- Add SQL Server support
- General Information
- Security
- Login
- Roles
- Databases
- User
- System
- Server Objects
- Backup Devices

## [0.5.2] - 2024-02-18

### Added
Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ PowerShell 5.1 and the following PowerShell modules are required for generating
- [DhcpServer Module](https://docs.microsoft.com/en-us/powershell/module/dhcpserver/?view=windowsserver2019-ps)
- [DnsServer Module](https://docs.microsoft.com/en-us/powershell/module/dnsserver/?view=windowsserver2019-ps)
- [FailoverClusters Module](https://learn.microsoft.com/en-us/powershell/module/failoverclusters/?view=windowsserver2022-ps)
- [DBATools Module](https://dbatools.io/)


### Linux & macOS

Expand All @@ -97,13 +99,15 @@ Install-WindowsFeature -Name RSAT-DHCP
# Hyper-V Server powershell modules
Install-WindowsFeature -Name Hyper-V-PowerShell
#IIS Server powershell modules
# IIS Server powershell modules
Install-WindowsFeature -Name web-mgmt-console
Install-WindowsFeature -Name Web-Scripting-Tools
#FailOver Cluster powershell modules
# FailOver Cluster powershell modules
Install-WindowsFeature -Name RSAT-Clustering-PowerShell
# DBATools for SQL
Install-Module dbatools
```

### PowerShell v5.x running on Windows client computer (Target)
Expand All @@ -126,6 +130,8 @@ Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerManagementTools
Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementScriptingTools
# DBATools for SQL
Install-Module dbatools
```

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

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

| Sub-Schema | Setting | Default | Description |
| ----------------- | ------------ | ------- | ---------------------------------------- |
| SQLLogin | true / false | false | Enable sql server login authentication . |
| SQLUserName | User defined | empty | Sql server login Username . |
| SQLSecurePassword | User defined | empty | Sql server login SecureString Password . |

#### Generating a SecureString

```powershell
PS C:\> "SecurePassword" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString
01000000d08c9ddf0115d1118c7a00c04fc297eb01000000b3605317d738c346801fbff6596b0d130000
PS C:\>
```
Copy/Paste the output text to the variable SQLSecurePassword

##### Note: Storing any credential in a file can pose a security risk. Use this option at your own risk!

### InfoLevel

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

### Healthcheck

Expand Down
1,657 changes: 977 additions & 680 deletions Samples/Sample Microsoft Windows As Built Report.html

Large diffs are not rendered by default.

Binary file modified Samples/Sample Microsoft Windows As Built Report.pdf
Binary file not shown.
83 changes: 83 additions & 0 deletions Src/Private/Get-AbrWinSQLBackupDevice.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
function Get-AbrWinSQLBackupDevice {
<#
.SYNOPSIS
Used by As Built Report to retrieve Windows SQL Server backup device information.
.DESCRIPTION
Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo.
.NOTES
Version: 0.5.3
Author: Jonathan Colon
Twitter: @rebelinux
Github: AsBuiltReport
Credits: Iain Brighton (@iainbrighton) - PScribo module
.LINK
https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows
#>
[CmdletBinding()]
param (
)

begin {
Write-PScriboMessage "SQL Server Backup Device InfoLevel set at $($InfoLevel.SQLServer)."
}

process {
try {
Write-PScriboMessage "Collecting SQL Server Backup Device information."
$SQLBackUpDevices = Get-DbaBackupDevice -SqlInstance $SQLServer | Sort-Object -Property Name
if ($SQLBackUpDevices) {
Write-PScriboMessage "Collecting SQL Server Backup Device information."
Section -Style Heading4 'Backup Device' {
$ItemInfo = @()
foreach ($Item in $SQLBackUpDevices) {
try {
$InObj = [Ordered]@{
'Name' = $Item.Name
'Backup Device Type' = $Item.BackupDeviceType
'Physical Location' = $Item.PhysicalLocation
'Skip Tape Label' = ConvertTo-TextYN $Item.SkipTapeLabel
}
$ItemInfo += [PSCustomObject]$InObj
} catch {
Write-PScriboMessage -IsWarning "SQL Server System Backup Device Section: $($_.Exception.Message)"
}
}

if ($InfoLevel.SQLServer -ge 2) {
Paragraph "The following sections detail the configuration of the backup device."
foreach ($Item in $ItemInfo) {
Section -Style NOTOCHeading5 -ExcludeFromTOC "$($Item.Name)" {
$TableParams = @{
Name = "Backup Device - $($Item.Name)"
List = $true
ColumnWidths = 50, 50
}
if ($Report.ShowTableCaptions) {
$TableParams['Caption'] = "- $($TableParams.Name)"
}
$Item | Table @TableParams
}
}
} else {
Paragraph "The following table summarises the configuration of the backup device."
BlankLine
$TableParams = @{
Name = "Backup Devices"
List = $false
Columns = 'Name', 'Backup Device Type', 'Physical Location'
ColumnWidths = 25, 25, 50
}
if ($Report.ShowTableCaptions) {
$TableParams['Caption'] = "- $($TableParams.Name)"
}
$ItemInfo | Table @TableParams
}
}
}
} catch {
Write-PScriboMessage -IsWarning "SQL Server Backup Device Section: $($_.Exception.Message)"
}
}
end {}
}
84 changes: 84 additions & 0 deletions Src/Private/Get-AbrWinSQLBuild.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
function Get-AbrWinSQLBuild {
<#
.SYNOPSIS
Used by As Built Report to retrieve Windows SQL Server Properties information.
.DESCRIPTION
Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo.
.NOTES
Version: 0.5.2
Author: Andrew Ramsay
Editor: Jonathan Colon
Twitter: @asbuiltreport
Github: AsBuiltReport
Credits: Iain Brighton (@iainbrighton) - PScribo module
.LINK
https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows
#>
[CmdletBinding()]
param (
)

begin {
Write-PScriboMessage "SQL Server InfoLevel set at $($InfoLevel.SQLServer)."
Write-PScriboMessage "Collecting SQL Server Properties information."
}

process {
if ($InfoLevel.SQLServer -ge 1) {
try {
$Properties = Get-DbaInstanceProperty -SqlInstance $SQLServer | ForEach-Object { @{$_.Name = $_.Value } }
$Build = Get-DbaBuild -SqlInstance $SQLServer -WarningAction SilentlyContinue
if ($Properties) {
Section -Style Heading3 'General Information' {
Paragraph 'The following table details sql server Properties information'
BlankLine
[array]$SQLServerObjt = @()
$TempSQLServerObjt = [PSCustomObject]@{
'Instance Name' = $Build.SqlInstance
'Fully Qualified Net Name' = $Properties.FullyQualifiedNetName
'Supported Until' = $Build.SupportedUntil.ToShortDateString()
'Edition' = $Properties.Edition
'Level' = "Microsoft SQL Server $($Build.NameLevel)"
'Build' = $Properties.VersionString
'Service Pack' = $Properties.ProductLevel
'Comulative Update' = ConvertTo-EmptyToFiller $Build.CULevel
'KB Level' = $Build.KBLevel
'Case Sensitive' = ConvertTo-TextYN $Properties.IsCaseSensitive
'Full Text Installed' = ConvertTo-TextYN $Properties.IsFullTextInstalled
'XTP Supported' = ConvertTo-TextYN $Properties.IsXTPSupported
'Clustered' = ConvertTo-TextYN $Properties.IsClustered
'Single User' = ConvertTo-TextYN $Properties.IsSingleUser
'Language' = $Properties.Language
'Collation' = $Properties.Collation
'Sql CharSet Name' = $Properties.SqlCharSetName
'Root Directory' = $Properties.RootDirectory
'Master DB Path' = $Properties.MasterDBPath
'Master DB Log Path' = $Properties.MasterDBLogPath
'Backup Directory' = $Properties.BackupDirectory
'Default File' = $Properties.DefaultFile
'Default Log' = $Properties.DefaultLog
'Login Mode' = $Properties.LoginMode
'Mail Profile' = ConvertTo-EmptyToFiller $Properties.MailProfile
'Warning' = ConvertTo-EmptyToFiller $Build.Warning
}
$SQLServerObjt += $TempSQLServerObjt

$TableParams = @{
Name = "General Information"
List = $True
ColumnWidths = 40, 60
}
if ($Report.ShowTableCaptions) {
$TableParams['Caption'] = "- $($TableParams.Name)"
}
$SQLServerObjt | Table @TableParams
}
}
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}
}
end {}
}
Loading

0 comments on commit 4ec7da2

Please sign in to comment.