Skip to content

Commit 62f1327

Browse files
authored
Merge pull request #45 from AsBuiltReport/copilot/recommendations-and-improvements
Fix bugs and code quality issues across PowerShell module source files
2 parents 64f4996 + 196e861 commit 62f1327

8 files changed

Lines changed: 12 additions & 15 deletions

Src/Private/Get-AbrWinHyperVSummary.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ function Get-AbrWinHyperVSummary {
3636
'VM Default Path' = $VmHost.VirtualMachinePath
3737
'VM Disk Default Path' = $VmHost.VirtualHardDiskPath
3838
'Supported VM Versions' = $VmHost.SupportedVmVersions -Join ","
39-
'Numa Spannning Enabled' = $VmHost.NumaSpanningEnabled
39+
'Numa Spanning Enabled' = $VmHost.NumaSpanningEnabled
4040
'Iov Support' = $VmHost.IovSupport
4141
'VM Migrations Enabled' = $VmHost.VirtualMachineMigrationEnabled
4242
'Allow any network for Migrations' = $VmHost.UseAnyNetworkForMigration
4343
'VM Migration Authentication Type' = $VmHost.VirtualMachineMigrationAuthenticationType
4444
'Max Concurrent Storage Migrations' = $VmHost.MaximumStorageMigrations
45-
'Max Concurrent VM Migrations' = $VmHost.MaximumStorageMigrations
45+
'Max Concurrent VM Migrations' = $VmHost.MaximumVirtualMachineMigrations
4646
}
4747
$OutObj += [pscustomobject](ConvertTo-HashToYN $inObj)
4848

Src/Private/Get-AbrWinIISWebSite.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function Get-AbrWinIISWebSite {
7272
'Name' = $IISWebSite.Name
7373
'Auto Start' = $IISWebSite.serverAutoStart
7474
'Enabled Protocols ' = $IISWebSite.enabledProtocols
75-
'URL' = Switch (($SiteURL.ResponseUri).count) {
75+
'URL' = Switch (($SiteURL.ResponseUri).Count) {
7676
0 { "--" }
7777
default { $SiteURL.ResponseUri }
7878
}

Src/Private/Get-AbrWinLocalUser.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function Get-AbrWinLocalUser {
3636
'User Name' = $LocalUser.Name
3737
'Description' = $LocalUser.Description
3838
'Account Enabled' = $LocalUser.Enabled
39-
'Last Logon Date' = Switch (($LocalUser.LastLogon).count) {
39+
'Last Logon Date' = Switch (($LocalUser.LastLogon).Count) {
4040
0 { "--" }
4141
default { $LocalUser.LastLogon.ToShortDateString() }
4242
}

Src/Private/Get-AbrWinOSConfig.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function Get-AbrWinOSConfig {
2121

2222
begin {
2323
Write-PScriboMessage "Operating System InfoLevel set at $($InfoLevel.OperatingSystem)."
24-
Write-PScriboMessage "Collecting Oprating System Configuration information."
24+
Write-PScriboMessage "Collecting Operating System Configuration information."
2525
}
2626

2727
process {
@@ -36,7 +36,7 @@ function Get-AbrWinOSConfig {
3636
'Windows Build Number' = $HostInfo.OsVersion
3737
'Windows Install Type' = $HostInfo.WindowsInstallationType
3838
'AD Domain' = $HostInfo.CsDomain
39-
'Windows Installation Date' = switch (($HostInfo.OsInstallDate).count) {
39+
'Windows Installation Date' = switch (($HostInfo.OsInstallDate).Count) {
4040
0 { "--" }
4141
default { $HostInfo.OsInstallDate.ToShortDateString() }
4242
}

Src/Private/Get-AbrWinSMBNetworkInterface.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function Get-AbrWinSMBNetworkInterface {
3535
foreach ($SMBNIC in $SMBNICs) {
3636
try {
3737
$inObj = [ordered] @{
38-
'Name' = Switch (($SMBNIC.InterfaceIndex).count) {
38+
'Name' = Switch (($SMBNIC.InterfaceIndex).Count) {
3939
0 { "Unknown" }
4040
default { Invoke-Command -Session $TempPssSession { (Get-NetAdapter -InterfaceIndex ($using:SMBNIC).InterfaceIndex).Name } }
4141
}

Src/Private/Get-RequiredFeature.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ function Get-RequiredFeature {
1515
The version of the required windows feature
1616
#>
1717

18+
[CmdletBinding()]
1819
Param
1920
(
20-
[CmdletBinding()]
2121
[Parameter(Mandatory = $true, ValueFromPipeline = $false)]
2222
[ValidateNotNullOrEmpty()]
2323
[String]
@@ -30,11 +30,11 @@ function Get-RequiredFeature {
3030

3131
[Parameter(Mandatory = $false, ValueFromPipeline = $false)]
3232
[Switch]
33-
$Feature = $False,
33+
$Feature,
3434

3535
[Parameter(Mandatory = $false, ValueFromPipeline = $false)]
3636
[Switch]
37-
$Status = $False,
37+
$Status,
3838

3939
[Parameter(Mandatory = $false, ValueFromPipeline = $false)]
4040
[ValidateNotNullOrEmpty()]

Src/Private/SharedUtilsFunctions.ps1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ function ConvertTo-HashToYN {
534534

535535
$result = [ordered] @{}
536536

537-
foreach ($i in $inObj.GetEnumerator()) {
537+
foreach ($i in $TEXT.GetEnumerator()) {
538538
try {
539539
$valueToProcess = $i.Value
540540

@@ -558,9 +558,6 @@ function ConvertTo-HashToYN {
558558
if ($result) {
559559
return $result
560560
} else {
561-
# If $TEXT was empty or processing failed to produce results, return the original (empty) $TEXT
562-
# Note: If $inObj was the source, and $TEXT is not used, this 'else' block might need review
563-
# based on how $TEXT is intended to be used when $inObj is empty.
564561
return $TEXT
565562
}
566563
} # end

Src/Public/Invoke-AsBuiltReport.Microsoft.Windows.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function Invoke-AsBuiltReport.Microsoft.Windows {
8585
#region foreach loop
8686
foreach ($System in $Target) {
8787

88-
if (Select-String -InputObject $System -Pattern "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$") {
88+
if (Select-String -InputObject $System -Pattern "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$" -Quiet) {
8989
throw "Please use the Fully Qualified Domain Name (FQDN) instead of an IP address when connecting to the System: $System"
9090
}
9191

0 commit comments

Comments
 (0)