Skip to content

Commit

Permalink
Minor code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelinux committed Jun 25, 2024
1 parent 87b6ac0 commit 4d17cae
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 50 deletions.
4 changes: 2 additions & 2 deletions Src/Private/Get-AbrWinApplication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-AbrWinApplication {
.DESCRIPTION
Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo.
.NOTES
Version: 0.5.4
Version: 0.5.5
Author: Andrew Ramsay
Editor: Jonathan Colon
Twitter: @asbuiltreport
Expand Down Expand Up @@ -47,7 +47,7 @@ function Get-AbrWinApplication {
}
'Install Date' = Switch ([string]::IsNullOrEmpty($App.InstallDate)) {
$true { "--" }
$false {$App.InstallDate}
$false { $App.InstallDate }
default { 'Unknown' }
}
}
Expand Down
8 changes: 4 additions & 4 deletions Src/Private/Get-AbrWinFOClusterSharedVolume.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-AbrWinFOClusterSharedVolume {
.DESCRIPTION
Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo.
.NOTES
Version: 0.5.2
Version: 0.5.5
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
Expand Down Expand Up @@ -36,9 +36,9 @@ function Get-AbrWinFOClusterSharedVolume {
'Name' = $Setting.Name
'Owner Node' = $Setting.OwnerNode
'Shared Volume' = Switch ([string]::IsNullOrEmpty($Setting.SharedVolumeInfo.FriendlyVolumeName)) {
$true {"Unknown"}
$false {$Setting.SharedVolumeInfo.FriendlyVolumeName}
default {"--"}
$true { "Unknown" }
$false { $Setting.SharedVolumeInfo.FriendlyVolumeName }
default { "--" }
}
'State' = $Setting.State
}
Expand Down
18 changes: 8 additions & 10 deletions Src/Private/Get-AbrWinHostStorageVolume.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-AbrWinHostStorageVolume {
.DESCRIPTION
Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo.
.NOTES
Version: 0.5.2
Version: 0.5.5
Author: Andrew Ramsay
Editor: Jonathan Colon
Twitter: @asbuiltreport
Expand All @@ -21,17 +21,17 @@ function Get-AbrWinHostStorageVolume {

begin {
Write-PScriboMessage "Storage InfoLevel set at $($InfoLevel.Storage)."
Write-PscriboMessage "Collecting Host Storage Volume information."
Write-PScriboMessage "Collecting Host Storage Volume information."
}

process {
if ($InfoLevel.Storage -ge 1) {
try {
$HostVolumes = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Volume | Where-Object {$_.DriveType -ne "CD-ROM" -and $_.DriveLetter} }
$HostVolumes = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-Volume | Where-Object { $_.DriveType -ne "CD-ROM" -and $_.DriveLetter } }
if ($HostVolumes) {
Section -Style Heading3 'Host Volumes' {
Paragraph 'The following section details local volumes on the host'
Blankline
BlankLine
$HostVolumeReport = @()
ForEach ($HostVolume in $HostVolumes) {
try {
Expand All @@ -44,9 +44,8 @@ function Get-AbrWinHostStorageVolume {
'Health Status' = $HostVolume.HealthStatus
}
$HostVolumeReport += $TempHostVolumeReport
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}
$TableParams = @{
Expand All @@ -60,9 +59,8 @@ function Get-AbrWinHostStorageVolume {
$HostVolumeReport | Sort-Object -Property 'Drive Letter' | Table @TableParams
}
}
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}
}
Expand Down
48 changes: 21 additions & 27 deletions Src/Private/Get-AbrWinIISWebSite.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-AbrWinIISWebSite {
.DESCRIPTION
Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo.
.NOTES
Version: 0.5.2
Version: 0.5.5
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
Expand All @@ -20,7 +20,7 @@ function Get-AbrWinIISWebSite {

begin {
Write-PScriboMessage "IIS InfoLevel set at $($InfoLevel.IIS)."
Write-PscriboMessage "Collecting IIS Sites information."
Write-PScriboMessage "Collecting IIS Sites information."
}

process {
Expand All @@ -30,7 +30,7 @@ function Get-AbrWinIISWebSite {
if ($IISWebSites) {
Section -Style Heading3 'Sites Summary' {
Paragraph 'The following table provide a summary of IIS Web Sites'
Blankline
BlankLine
$IISWebSitesrReport = @()
foreach ($IISWebSite in $IISWebSites) {
try {
Expand All @@ -41,9 +41,8 @@ function Get-AbrWinIISWebSite {
'Application Pool' = $IISWebSite.applicationPool
}
$IISWebSitesrReport += $TempIISWebSitesrReport
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}

Expand All @@ -61,21 +60,21 @@ function Get-AbrWinIISWebSite {
if ($IISWebSites) {
Section -Style Heading4 'Sites Configuration' {
Paragraph 'The following section details IIS Web Sites configuration'
Blankline
BlankLine
$IISWebSitesrReport = @()
foreach ($IISWebSite in $IISWebSites) {
try {
Section -Style Heading5 "$($IISWebSite.Name)" {
Paragraph "The following table details $($IISWebSite.Name) settings"
Blankline
$SiteURL = Invoke-Command -Session $TempPssSession { Get-WebURL -PSPath "IIS:\Sites\$(($using:IISWebSite).Name)"}
BlankLine
$SiteURL = Invoke-Command -Session $TempPssSession { Get-WebURL -PSPath "IIS:\Sites\$(($using:IISWebSite).Name)" }
$TempIISWebSitesrReport = [PSCustomObject]@{
'Name' = $IISWebSite.Name
'Auto Start' = ConvertTo-TextYN $IISWebSite.serverAutoStart
'Enabled Protocols ' = $IISWebSite.enabledProtocols
'URL' = Switch (($SiteURL.ResponseUri).count) {
0 {"--"}
default {$SiteURL.ResponseUri}
0 { "--" }
default { $SiteURL.ResponseUri }
}
'Path ' = $IISWebSite.physicalPath
'Log Path' = $IISWebSite.logFile.directory
Expand All @@ -97,7 +96,7 @@ function Get-AbrWinIISWebSite {
if ($IISWebApps) {
Section -Style Heading5 "Web Applications" {
Paragraph "The following table details $($IISWebSite.Name) Web Application"
Blankline
BlankLine
$IISWebAppsReport = @()
foreach ($IISWebApp in $IISWebApps) {
try {
Expand All @@ -107,9 +106,8 @@ function Get-AbrWinIISWebSite {
'Physical Path ' = $IISWebApp.PhysicalPath
}
$IISWebAppsReport += $TempIISWebAppsReport
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}

Expand All @@ -124,27 +122,23 @@ function Get-AbrWinIISWebSite {
$IISWebAppsReport | Table @TableParams
}
}
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}
}
}
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}
}
}
catch {
Write-PscriboMessage -IsWarning $_.Exception.Message
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions Src/Private/Get-AbrWinOSHotfix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-AbrWinOSHotfix {
.DESCRIPTION
Documents the configuration of Microsoft Windows Server in Word/HTML/Text formats using PScribo.
.NOTES
Version: 0.5.2
Version: 0.5.5
Author: Andrew Ramsay
Editor: Jonathan Colon
Twitter: @asbuiltreport
Expand Down Expand Up @@ -37,9 +37,9 @@ function Get-AbrWinOSHotfix {
'Hotfix ID' = $HotFix.HotFixID
'Description' = $HotFix.Description
'Installation Date' = Switch ([string]::IsNullOrEmpty($HotFix.InstalledOn)) {
$true {'--'}
$false {$HotFix.InstalledOn.ToShortDateString()}
default {'Unknown'}
$true { '--' }
$false { $HotFix.InstalledOn.ToShortDateString() }
default { 'Unknown' }
}
}
$HotfixReport += $TempHotFix
Expand Down
5 changes: 2 additions & 3 deletions Src/Private/Get-RequiredFeature.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-RequiredFeature {
.DESCRIPTION
Function to check if the required version of windows feature is installed
.NOTES
Version: 0.5.2
Version: 0.5.5
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
Expand Down Expand Up @@ -88,8 +88,7 @@ function Get-RequiredFeature {
Write-PScriboMessage -IsWarning "$Name module is required to be installed on $System to be able to document $Service service. Run 'Install-WindowsFeature -Name '$($Name)'' to install the required modules."
}
}
}
else {
} else {
throw "Unable to validate if $Name is installed. https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Windows"
}
}
Expand Down

0 comments on commit 4d17cae

Please sign in to comment.