Problem with invoke-command and forms

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
miketartaglia
Posts: 100
Joined: Mon Feb 02, 2015 7:44 am

Problem with invoke-command and forms

Post 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
}

User avatar
Alexander Riedel
Posts: 7457
Joined: Tue May 29, 2007 4:43 pm

Re: Problem with invoke-command and forms

Post by Alexander Riedel »

[Topic moved by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.

jvierra
Posts: 14543
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Problem with invoke-command and forms

Post 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.

User avatar
miketartaglia
Posts: 100
Joined: Mon Feb 02, 2015 7:44 am

Re: Problem with invoke-command and forms

Post 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

Locked