PowerShell
PowerShell copied to clipboard
Method invocation failed: System.Object does not contain 'Trim'
I'm getting an error on one of the trims:
Method invocation failed because [System.Object[]] does not contain a method named 'Trim'. At line:190 char:5
190: $Output = (((((cmd.exe /c $Arguments | Where-Object { $_ -like "Enabled" } | Where-Object { $_ -notlike "example" }) -replace 'Enabled', '').Trim()) -replace '^\d+', '').Trim()) | ForEach-Object { ($_ -split ' {2,}')[1] }