dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Get-DbaStartupParameter - Fix -Simple parameter not being passed to scriptblock

Open potatoqualitee opened this issue 5 months ago • 2 comments

The -Simple parameter was not working because it was referenced inside the scriptblock but never passed as an argument. This fix adds $Simple as the third argument to the scriptblock and passes it in both Invoke-ManagedComputerCommand calls.

Also added tests to verify the -Simple parameter correctly filters output properties.

Fixes #9196

Generated with Claude Code

potatoqualitee avatar Dec 02 '25 00:12 potatoqualitee

@claude pls make some decisions Failed tests summary: Path : Get-DbaStartupParameter/Command actually works/Simple parameter returns only essential properties Name : It Simple parameter returns only essential properties Result : Failed Message : ErrorRecord: Expected @('ComputerName', 'InstanceName', 'SqlInstance', 'MasterData', 'MasterLog', 'ErrorLog', 'TraceFlags', 'DebugFlags', 'ParameterString'), but got @('ComputerName', 'DebugFlags', 'ErrorLog', 'InstanceName', 'MasterData', 'MasterLog', 'ParameterString', 'SqlInstance', 'TraceFlags'). StackTrace : RawErrorRecord : Expected @('ComputerName', 'InstanceName', 'SqlInstance', 'MasterData', 'MasterLog', 'ErrorLog', 'TraceFlags', 'DebugFlags', 'ParameterString'), but got @('ComputerName', 'DebugFlags', 'ErrorLog', 'InstanceName', 'MasterData', 'MasterLog', 'ParameterString', 'SqlInstance', 'TraceFlags'). Uploading artifact DetailedTestFailures_Pester5.json (1,729 bytes)...100%

potatoqualitee avatar Dec 05 '25 13:12 potatoqualitee

Claude finished @potatoqualitee's task —— View job


Test fix completed ✓

The test was failing because PowerShell returns property names in alphabetical order, but the test was expecting them in a specific order.

Tasks:

  • [x] Read the test file to understand current implementation
  • [x] Fix the property order comparison in the test
  • [x] Commit and push the fix

What I changed:

  • Updated the test in tests/Get-DbaStartupParameter.Tests.ps1 to sort both the actual and expected property arrays before comparison
  • Changed from Should -Be (which requires exact order) to Compare-Object with sorted arrays, which properly compares arrays regardless of order
  • This follows the dbatools pattern used in other parameter validation tests

The test should now pass since it correctly validates that all expected properties are present, without caring about their order.

--- |

claude[bot] avatar Dec 05 '25 13:12 claude[bot]