Forum Discussion

HSBHSB's avatar
HSBHSB
Copper Contributor
Apr 12, 2024

Powershell Environment Variable NULL - No repository named PSGallery

I have an SSIS package that runs as a specific user.

 

It calls a Powershell script and it used to work. We rebooted the server and now we get the following error complaining about $env:LOCALAPPDATA being NULL.

PS>TerminatingError(Join-Path): "Cannot bind argument to parameter 'Path' because it is null."
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.4\PSModule.psm1:95 char:81
+ ... osoft.PowerShell.Management\Join-Path -Path $env:LOCALAPPDATA -ChildP ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId :
ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
The variable '$script:PSGetAppLocalPath' cannot be retrieved because it has not been set.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.4\PSModule.psm1:102 char:86
+ ... werShell.Management\Join-Path -Path $script:PSGetAppLocalPath -ChildP ...

 

We also get the following message:

Set-PSRepository : No repository with the name 'PSGallery' was found. 

 

 

If the user the SSIS packages runs as, is logged onto the server, the SSIS package works just fine. If I log out and re-schedule the package, it fails again.

 

  • Andres-Bohren's avatar
    Andres-Bohren
    Steel Contributor
    Hi HSBHSB
    >Set-PSRepository : No repository with the name 'PSGallery' was found.
    Try this:
    Register-PSRepository -Default

    >$env:LOCALAPPDATA
    List environement Variables
    Get-ChildItem env:

    Kind Regards
    Andres

Resources