locked
Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. RRS feed

  • Question

  • I'm new to powershell and trying to make a script to take cluster resources offline remotely using powershell but stuck with error.

    $resource = 'servername'

    Invoke-Command -Computername remoteservername -ScriptBlock {Stop-ClusterGroup $resource}

    Error

    Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

        + CategoryInfo          : InvalidData: (:) [Stop-ClusterGroup], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.FailoverClusters.PowerShell.StopClusterGroupCommand


    Thursday, June 21, 2018 7:16 PM

All replies

  • You have to pass that as an argument on the invoke.


    \_(ツ)_/

    Thursday, June 21, 2018 7:28 PM
  • Also, you can reference the variable this way $using:resource
    Thursday, June 21, 2018 11:19 PM