Some knife winrm query command errors with encoding error


I am trying to execute remote commands on a windows host to create a storage pool using knife winrm.

knife winrm ‘name:ad01’ 'powershell Get-StoragePool ’ -x admin

runs fine but if I try to create a storage pool with

knife winrm ‘name:ad01’ ‘New-StoragePool –FriendlyName ad01Data01 –StorageSubsystemFriendlyName “Storage Spaces*” –PhysicalDisks (Get-PhysicalDisk –CanPool $True)’ -x opsadmin

The following error is returned

ERROR: Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and CP850

Thanks in advance



It turned out that the error was generated because the minus signs in my PowerShell command were a weird character and not a minus sign. (Copy and paste issue on my part :frowning:)



I saw a “pro tip” on twitter that recommended configuring your editor to highlight these kinds of “unicode false friends” like hyphen lookalikes, non-breaking space, etc.

1 Like