Skip to content

Start-ChocolateyProcessAsAdmin Module Import for PowerShell causes errors #901

Closed

Description

@sergey-s-betke

What You Are Seeing?

On Start-ChocolateyProcessAsAdmin (signcode.install v1.0.2):

#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Подготовка модулей к первому использованию.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">2</I64><PR N="Record"><AV>Подготовка модулей к первому использованию.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><S S="debug">Host version is 5.0.10586.494, PowerShell Version is '5.0.10586.494' and CLR Version is '4.0.30319.42000'.</S><S S="debug">Loading community extensions</S><S S="verbose">Экспорт функции "Format-FileSize".</S><S S="verbose">Экспорт функции "Get-ChecksumValid".</S><S S="verbose">Экспорт функции "Get-ChocolateyUnzip".</S><S S="verbose">Экспорт функции "Get-ChocolateyWebFile".</S><S S="verbose">Экспорт функции "Get-EnvironmentVariable".</S><S S="verbose">Экспорт функции "Get-EnvironmentVariableNames".</S><S S="verbose">Экспорт функции "Get-FtpFile".</S><S S="verbose">Экспорт функции "Get-OSArchitectureWidth".</S><S S="verbose">Экспорт функции "Get-ToolsLocation".</S><S S="verbose">Экспорт функции "Get-UACEnabled".</S><S S="verbose">Экспорт функции "Get-UninstallRegistryKey".</S><S S="verbose">Экспорт функции "Get-VirusCheckValid".</S><S S="verbose">Экспорт функции "Get-WebFile".</S><S S="verbose">Экспорт функции "Get-WebFileName".</S><S S="verbose">Экспорт функции "Get-WebHeaders".</S><S S="verbose">Экспорт функции "Install-BinFile".</S><S S="verbose">Экспорт функции "Install-ChocolateyDesktopLink".</S><S S="verbose">Экспорт функции "Install-ChocolateyEnvironmentVariable".</S><S S="verbose">Экспорт функции "Install-ChocolateyExplorerMenuItem".</S><S S="verbose">Экспорт функции "Install-ChocolateyFileAssociation".</S><S S="verbose">Экспорт функции "Install-ChocolateyInstallPackage".</S><S S="verbose">Экспорт функции "Install-ChocolateyPackage".</S><S S="verbose">Экспорт функции "Install-ChocolateyPath".</S><S S="verbose">Экспорт функции "Install-ChocolateyPinnedTaskBarItem".</S><S S="verbose">Экспорт функции "Install-ChocolateyPowershellCommand".</S><S S="verbose">Экспорт функции "Install-ChocolateyShortcut".</S><S S="verbose">Экспорт функции "Install-ChocolateyVsixPackage".</S><S S="verbose">Экспорт функции "Install-ChocolateyZipPackage".</S><S S="verbose">Экспорт функции "Install-Vsix".</S><S S="verbose">Экспорт функции "Set-EnvironmentVariable".</S><S S="verbose">Экспорт функции "Set-PowerShellExitCode".</S><S S="verbose">Экспорт функции "Start-ChocolateyProcessAsAdmin".</S><S S="verbose">Экспорт функции "Test-ProcessAdminRights".</S><S S="verbose">Экспорт функции "Uninstall-BinFile".</S><S S="verbose">Экспорт функции "Uninstall-ChocolateyEnvironmentVariable".</S><S S="verbose">Экспорт функции "Uninstall-ChocolateyPackage".</S><S S="verbose">Экспорт функции "Uninstall-ChocolateyZipPackage".</S><S S="verbose">Экспорт функции "Update-SessionEnvironment".</S><S S="verbose">Экспорт функции "Write-ChocolateyFailure".</S><S S="verbose">Экспорт функции "Write-ChocolateySuccess".</S><S S="verbose">Экспорт функции "Write-FileUpdateLog".</S><S S="verbose">Экспорт псевдонима "Get-ProcessorBits".</S><S S="verbose">Экспорт псевдонима "Get-InstallRegistryKey".</S><S S="verbose">Экспорт псевдонима "Generate-BinFile".</S><S S="verbose">Экспорт псевдонима "Add-BinFile".</S><S S="verbose">Экспорт псевдонима "Remove-BinFile".</S><S S="verbose">Экспорт псевдонима "refreshenv".</S><S S="verbose">Импорт функции "Format-FileSize".</S><S S="verbose">Импорт функции "Get-ChecksumValid".</S><S S="verbose">Импорт функции "Get-ChocolateyUnzip".</S><S S="verbose">Импорт функции "Get-ChocolateyWebFile".</S><S S="verbose">Импорт функции "Get-EnvironmentVariable".</S><S S="verbose">Импорт функции "Get-EnvironmentVariableNames".</S><S S="verbose">Импорт функции "Get-FtpFile".</S><S S="verbose">Импорт функции "Get-OSArchitectureWidth".</S><S S="verbose">Импорт функции "Get-ToolsLocation".</S><S S="verbose">Импорт функции "Get-UACEnabled".</S><S S="verbose">Импорт функции "Get-UninstallRegistryKey".</S><S S="verbose">Импорт функции "Get-VirusCheckValid".</S><S S="verbose">Импорт функции "Get-WebFile".</S><S S="verbose">Импорт функции "Get-WebFileName".</S><S S="verbose">Импорт функции "Get-WebHeaders".</S><S S="verbose">Импорт функции "Install-BinFile".</S><S S="verbose">Импорт функции "Install-ChocolateyDesktopLink".</S><S S="verbose">Импорт функции "Install-ChocolateyEnvironmentVariable".</S><S S="verbose">Импорт функции "Install-ChocolateyExplorerMenuItem".</S><S S="verbose">Импорт функции "Install-ChocolateyFileAssociation".</S><S S="verbose">Импорт функции "Install-ChocolateyInstallPackage".</S><S S="verbose">Импорт функции "Install-ChocolateyPackage".</S><S S="verbose">Импорт функции "Install-ChocolateyPath".</S><S S="verbose">Импорт функции "Install-ChocolateyPinnedTaskBarItem".</S><S S="verbose">Импорт функции "Install-ChocolateyPowershellCommand".</S><S S="verbose">Импорт функции "Install-ChocolateyShortcut".</S><S S="verbose">Импорт функции "Install-ChocolateyVsixPackage".</S><S S="verbose">Импорт функции "Install-ChocolateyZipPackage".</S><S S="verbose">Импорт функции "Install-Vsix".</S><S S="verbose">Импорт функции "Set-EnvironmentVariable".</S><S S="verbose">Импорт функции "Set-PowerShellExitCode".</S><S S="verbose">Импорт функции "Start-ChocolateyProcessAsAdmin".</S><S S="verbose">Импорт функции "Test-ProcessAdminRights".</S><S S="verbose">Импорт функции "Uninstall-BinFile".</S><S S="verbose">Импорт функции "Uninstall-ChocolateyEnvironmentVariable".</S><S S="verbose">Импорт функции "Uninstall-ChocolateyPackage".</S><S S="verbose">Импорт функции "Uninstall-ChocolateyZipPackage".</S><S S="verbose">Импорт функции "Update-SessionEnvironment".</S><S S="verbose">Импорт функции "Write-ChocolateyFailure".</S><S S="verbose">Импорт функции "Write-ChocolateySuccess".</S><S S="verbose">Импорт функции "Write-FileUpdateLog".</S><S S="verbose">Импорт псевдонима "Add-BinFile".</S><S S="verbose">Импорт псевдонима "Generate-BinFile".</S><S S="verbose">Импорт псевдонима "Get-InstallRegistryKey".</S><S S="verbose">Импорт псевдонима "Get-ProcessorBits".</S><S S="verbose">Импорт псевдонима "refreshenv".</S><S S="verbose">Импорт псевдонима "Remove-BinFile".</S></Objs>

What is Expected?

May be $null = import-module... in Start-ChocolateyProcessAsAdmin? Import-Module return imported object: https://technet.microsoft.com/en-us/library/hh849725.aspx

Activity

  1. ferventcoder commented on Aug 9, 2016

    @ferventcoder
    Member

    Out of curiosity, can you possibly translate the errors you are seeing? Would save me a step.

  2. added
    0 - TriagingIssue is accepted, but a milestone has yet to be added for the issue.
    on Aug 9, 2016
  3. sergey-s-betke commented on Aug 10, 2016

    @sergey-s-betke
    Author

    https://ci.appveyor.com/project/sergey-s-betke/font-gost2-304-81/build/0.8.0-extract-makeutils.150.build.217
    log time at 00:08:58

    There is import-module return value. I think, code in Start-ChocolateyProcessAsAdmin

    $exeToRun = "$($env:SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe"
    $importChocolateyHelpers = ""
    Get-ChildItem "$helpersPath" -Filter *.psm1 | ForEach-Object { $importChocolateyHelpers = "& import-module -name  `'$($_.FullName)`';$importChocolateyHelpers" };
    $block = ...
    

    must be changed to

    $exeToRun = "$($env:SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe"
    $importChocolateyHelpers = ""
    Get-ChildItem "$helpersPath" -Filter *.psm1 | ForEach-Object { $importChocolateyHelpers = "import-module -name  `'$($_.FullName)`' | Out-Null; $importChocolateyHelpers" };
    $block = ...
    

    or

    $exeToRun = "$($env:SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe"
    $importChocolateyHelpers = ""
    Get-ChildItem "$helpersPath" -Filter *.psm1 | ForEach-Object { $importChocolateyHelpers = "`$null = import-module -name  `'$($_.FullName)`'; $importChocolateyHelpers" };
    $block = ...
    
  4. sergey-s-betke commented on Aug 10, 2016

    @sergey-s-betke
    Author
  5. added
    Up For GrabsIssues that are available by the community to work on.
    0 - BacklogIssue is accepted, but is not ready to be worked on or not in current sprint.
    Priority - LowRepresents issues that are of lower priority, can be taken care of whenever.
    and removed
    0 - TriagingIssue is accepted, but a milestone has yet to be added for the issue.
    on Aug 11, 2016
  6. added this to the 0.10.1 milestone on Aug 11, 2016
  7. ferventcoder commented on Aug 11, 2016

    @ferventcoder
    Member

    I understand now. Remove the logging of the import module when done in that method. Added to backlog as an enhancement.

  8. sergey-s-betke commented on Aug 11, 2016

    @sergey-s-betke
    Author

    No, @ferventcoder , it is error, not enhancement. Now choco install --failonstderr FAILED, when Start-ChocolateyProcessAsAdmin used...

  9. ferventcoder commented on Aug 11, 2016

    @ferventcoder
    Member

    This is breaking the package then? Ah, I didn't catch that from above.

  10. changed the title [-]Start-ChocolateyProcessAsAdmin[/-] [+]Start-ChocolateyProcessAsAdmin Module Import for PowerShell causes errors.[/+] on Aug 11, 2016
  11. changed the title [-]Start-ChocolateyProcessAsAdmin Module Import for PowerShell causes errors.[/-] [+]Start-ChocolateyProcessAsAdmin Module Import for PowerShell causes errors[/+] on Aug 11, 2016
  12. 3 remaining items

  13. removed
    Priority - LowRepresents issues that are of lower priority, can be taken care of whenever.
    Priority - HighRepresent high priority tickets - things that must be addressed soon.
    on Aug 11, 2016
  14. ferventcoder commented on Aug 11, 2016

    @ferventcoder
    Member

    I suggest not using FailOnStdErr - that is there to give you time to move off of the dependency of using it. 0.9.8.x didn't fail on stderr, only 0.9.9.x. We fixed the bug for 0.9.10.x+.

  15. sergey-s-betke commented on Aug 11, 2016

    @sergey-s-betke
    Author

    Ok. Thank for Your attention.

  16. ferventcoder commented on Aug 11, 2016

    @ferventcoder
    Member

    I did earmark this for vNext though so we don't show that output, as that could be annoying.

  17. self-assigned this
    on Aug 15, 2016
  18. added
    4 - DoneCode has been added to the repository, and has been reviewed by a team member.
    and removed
    0 - BacklogIssue is accepted, but is not ready to be worked on or not in current sprint.
    on Aug 15, 2016
  19. ferventcoder commented on Aug 15, 2016

    @ferventcoder
    Member

    This is fixed for 0.10.1

  20. sergey-s-betke commented on Aug 15, 2016

    @sergey-s-betke
    Author

    Thank You!

  21. added 2 commits that reference this issue on Aug 17, 2016
  22. added
    5 - ReleasedThe issue has been resolved, and released to the public for consumption.
    and removed
    4 - DoneCode has been added to the repository, and has been reviewed by a team member.
    on Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

5 - ReleasedThe issue has been resolved, and released to the public for consumption.BugIssues where something has happened which was not expected or intended.Up For GrabsIssues that are available by the community to work on.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions