Forum Discussion
__Martin__
Aug 12, 2020Copper Contributor
Why does Powershell say that my variables are empty or null?
Dear Techcommunity I wanted to ask why my Script keeps on saying that these variables are empty or null. the following variables are affected: $pcname = 'server01'
$RDdestfile = "C:\Scripts\Cer...
- Aug 12, 2020
Because you're trying to use them within a remote session. You either need to set them within the remote session or pass them using a script block/the "using" scope modifier: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_remote_variables?view=powershell-7#using-local-variables
VasilMichev
Aug 12, 2020MVP
Because you're trying to use them within a remote session. You either need to set them within the remote session or pass them using a script block/the "using" scope modifier: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_remote_variables?view=powershell-7#using-local-variables