Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xRemoteFile does not work with PowerShell 7.2.1 #743

Open
IlleNilsson opened this issue Feb 5, 2022 · 4 comments
Open

xRemoteFile does not work with PowerShell 7.2.1 #743

IlleNilsson opened this issue Feb 5, 2022 · 4 comments
Labels
bug The issue is a bug. needs investigation The issue needs to be investigated by the maintainers or/and the community.

Comments

@IlleNilsson
Copy link

Problem description

When using Header property of xRemoteFile, creating MOF-file fails.

    Headers = @{ 'Accept-Language' = 'en-US' } # NOTE: This line does not work with newer versions than 5.1 of WindowsPowerShell

Verbose logs

-

DSC configuration

configuration SetupPSTools {
    param(
        [PSCredential]$SetupCredential,
        [string[]]$DependsOnResource
    )

    Import-DscResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion 9.1.0
    Import-DscResource -ModuleName PSDesiredStateConfiguration

    $psToolsFileName = 'PSTools.zip'
    $psToolsUrl = "https://download.sysinternals.com/files/$psToolsFileName"
    $psToolsDestination = "C:\Users\Public\Downloads\$psToolsFileName"
    $psToolsFolder = '%ProgramFiles%\PSTools'

    # INFO: Unzip PSTools in Program Folder
    Archive 'PSTools' {
        PsDscRunAsCredential = $SetupCredential
        Path = $psToolsDestination
        Destination = $psToolsFolder
        DependsOn = @('[xRemoteFile]PSTools')
    }
    # INFO: Download PSTools Files to Download Folder
    xRemoteFile 'PSTools' {
        PsDscRunAsCredential = $SetupCredential
        Uri = $psToolsUrl
        DestinationPath = $psToolsDestination
        MatchSource = $true
        UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer
        Headers = @{ 'Accept-Language' = 'en-US' } # NOTE: This line does not work with newer versions than 5.1 of WindowsPowerShell
        DependsOn = $DependsOnResource
    }
}

Suggested solution

I have no idea

Operating system the target node is running

Windows 10, up to date

PowerShell version and build the target node is running

PowerShell 7.2.1

xPSDesiredStateConfiguration version

9.1.0
@PlagueHO PlagueHO added bug The issue is a bug. needs investigation The issue needs to be investigated by the maintainers or/and the community. labels Feb 5, 2022
@PlagueHO
Copy link
Member

PlagueHO commented Feb 5, 2022

Hi @IlleNilsson - thank you for raising this.

A few questions to help us diagnose this:

  1. Does an error occur when passing the headers or are they just ignored?
  2. Is the issue with the specific Accept-Language header or any header?

Thank you!

@IlleNilsson
Copy link
Author

IlleNilsson commented Feb 6, 2022 via email

@PlagueHO
Copy link
Member

PlagueHO commented Feb 9, 2022

Thanks @IlleNilsson - It sounds like this error was occurring while compiling the MOF, rather than while running the code. Does that sound correct?

@IlleNilsson
Copy link
Author

IlleNilsson commented Feb 9, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. needs investigation The issue needs to be investigated by the maintainers or/and the community.
Projects
None yet
Development

No branches or pull requests

2 participants