Page 1 of 1

Problem with invoke-command and forms

Posted: Fri Jul 31, 2020 1:15 pm
by miketartaglia
Could use some help as to why I am getting the following errors.

SEE CODE at the bottom of this post
----------------------
Product, version and build:Powershell Studio 5.7.1.179
32 or 64 bit version of product:
Operating system: windows 10
32 or 64 bit OS: 64

ERROR: Cannot bind argument to parameter 'Name' because it is null.
ERROR: + CategoryInfo : InvalidData: (:) [Disable-TlsCipherSuite], ParameterBindingValidationException
ERROR: + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.WindowsAuthenticationProtocols.Commands.RemoveTlsCipherSuiteCommand
ERROR: + PSComputerName : DALC6-OCSQ01P
------------------------
CODE:

$cipherToDisable = "TLS_PSK_WITH_NULL_SHA256"
#$name = $cipherListBox
Write-Host $name
$test = Invoke-Command -ComputerName $serverNameLabel.Text.ToString() -ScriptBlock {Disable-TlsCipherSuite -Name $cipherToDisable
}

Re: Problem with invoke-command and forms

Posted: Fri Jul 31, 2020 1:24 pm
by Alexander Riedel
[Topic moved by moderator]

Re: Problem with invoke-command and forms

Posted: Fri Jul 31, 2020 2:42 pm
by jvierra
You haven't passed the variable to the script block.

To get a full understanding of how to use "Invoke-Command" see the following topic:

help Invoke-Command -online

There are numerous ways to pass this variables. I t is useful to understand all and how they work.

Re: Problem with invoke-command and forms

Posted: Sat Aug 01, 2020 7:22 am
by miketartaglia
thank you so much! I was able to use example 9 to help me. I just can't believe I have never ran into this before. LOL