Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 获取停止NlbClusterNode:找不到与参数名称';凭证';。停止节点时出错_Windows_Powershell_Credentials_Nlb - Fatal编程技术网

Windows 获取停止NlbClusterNode:找不到与参数名称';凭证';。停止节点时出错

Windows 获取停止NlbClusterNode:找不到与参数名称';凭证';。停止节点时出错,windows,powershell,credentials,nlb,Windows,Powershell,Credentials,Nlb,我正在使用以下脚本停止计算机上的节点。但是获取停止NlbClusterNode:找不到与参数名称“Credential”匹配的参数。使用power shell脚本和windows 2012停止节点时出错。另外,如何在此脚本中传递密码。请导游 #This script monitors stopped application pools along with websites on the current host $RemoteHostName = "testserver" #set h

我正在使用以下脚本停止计算机上的节点。但是获取停止NlbClusterNode:找不到与参数名称“Credential”匹配的参数。使用power shell脚本和windows 2012停止节点时出错。另外,如何在此脚本中传递密码。请导游

#This script monitors stopped application pools along with websites on the current host
$RemoteHostName = "testserver"
    #set hostname
    #import NLB module.  In PS v3 these lines should be redundant and can be removed.
    import-module NetworkLoadBalancingClusters
    "Networking Load Balancing Clusters Module imported"
    # requests the user's credentials and assigns the credentials to an object
    $Credential = Get-Credential "domain\testuser"
    "Get credentials for test user done"
    #uses the nlb cmdlets to check the state of the current cluster
    $clusterstatus = get-nlbclusternode -nodename $RemoteHostName
    [string]$status = $clusterstatus | select -expand state
    "Got the status of cluster $clusterstatus"
        #if the node has already been stopped dont do anything
    if ($status -eq "Stopped")
        {
            #donothing 
            "Node alrerady stopped"
        }

        #if the node hasnt been stopped, stop the node and then send an email out
    else
        {
        "Starting to drain stop the node"
            stop-NlbClusterNode -HostName $RemoteHostName -Credential $Credential -Drain
        }

start sleep-s 30

stop-NlbClusterNode
cmdlet没有
-credential
参数:是的,您是对的,此脚本现在在本地运行正常,但如何摆脱用户名和密码提示删除此行
$Credential=Get-Credential“domain\testuser”
,但我想我错过了你的问题……如果我删除了你建议的行,它将给出Get-nlbclusternode:访问被拒绝错误。现在的问题是如何在凭据中传递密码。但在代码中,在
get-nlbclusternode
中不使用
$credential
,而且此cmdlet也没有
--credential
参数。。。您需要从具有群集管理凭据的用户处运行代码