Skip to content

Module doesn't work with modern Powershell #168

@ananace

Description

@ananace

Trying to manage windowsfeatures causes errors to the tune of;

Could not prefetch windowsfeature provider 'default': Malformed XML: Content at the start of the document (got 'Set-PSReadLineOption : The handle is invalid.
At C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1:2 char:1
+ Set-PSReadLineOption -PredictionViewStyle ListView
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-PSReadLineOption], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.SetPSReadLineOption
 
Set-PSReadLineOption : The predictive suggestion feature cannot be enabled because the console output doesn't support v
irtual terminal processing or it's redirected.
At C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1:3 char:1
+ Set-PSReadLineOption -PredictionSource History
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-PSReadLineOption], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.SetPSReadLineOption
 
')
Line: 16
Position: 998
Last 80 unconsumed characters:
<?xml version="1.0" encoding="utf-8"?>

This is likely because it needs to use the parameter -NoProfile when running its commands, so that it doesn't try to initialize the full interactive profile.

Perhaps the module should be migrated to use pwshlib instead of running raw commands?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions