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.
This topic is 3 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
mtartaglia
Posts: 101
Last visit: Mon Dec 19, 2022 11:45 am

Problem with invoke-command and forms

Post by mtartaglia »

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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 20
Been upvoted: 37 times

Re: Problem with invoke-command and forms

Post by Alexander Riedel »

[Topic moved by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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
mtartaglia
Posts: 101
Last visit: Mon Dec 19, 2022 11:45 am

Re: Problem with invoke-command and forms

Post by mtartaglia »

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
This topic is 3 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked