Hi everyone
I'm a little frustrated, because I don't understand why this is not working.
First this works.
$Modules = "DnsServer","DnsClient" $s = New-PSSession -ComputerName $computerName -Credential Corp\Administrator Invoke-Command -Session $s -ScriptBlock {Import-Module -name DnsServer,DnsClient -PassThru} Import-PSSession -Session $s -AllowClobber -Module $modules
But this doesn't, it says name are null values
$Modules = "DnsServer","DnsClient" $s = New-PSSession -ComputerName $computerName -Credential Corp\Administrator Invoke-Command -Session $s -ScriptBlock {Import-Module $modules -PassThru} Import-PSSession -Session $s -AllowClobber -Module $modules
error message Cannot bind argument to parameter 'Name' because it is null. + CategoryInfo : InvalidData: (:) [Import-Module], ParameterBindingValidationException+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ImportModuleCommand+ PSComputerName : 192.168.0.221
I'm not passing the variable correctly, but I've tried what feels like a thousand different ways with no success.
Can anyone tell me what I'm doing wrong.
Regards
Ernie Prescott