在调用中填充变量

时间:2017-02-28 17:58:33

标签: powershell citrix

我需要$ localuser来填充运行脚本的用户的用户名,我的同事给了我这个,但它不起作用。还有其他想法吗?

<div class='centerplease'>
  FAQ accordion
</div>
<br>

<div class="content">
<div>
  <input type="checkbox" id="question1" name="q"  class="questions">
  <div class="plus">+</div>
  <label for="question1" class="question">
    This is the question that will be asked?
  </label>
  <div class="answers">
    What if the answer is really long and wraps the whole page and you never want to finish it but you have to because its the answer!
  </div>
</div>

<div>
  <input type="checkbox" id="question2" name="q" class="questions">
  <div class="plus">+</div>
  <label for="question2" class="question">
    Short?
  </label>
  <div class="answers">
    short!
  </div>
</div>
  
<div>
  <input type="checkbox" id="question3" name="q" class="questions">
  <div class="plus">+</div>
  <label for="question3" class="question">
    But what if the question is really long and wraps the whole page and you feel like you will never finish reading the question?
  </label>
  <div class="answers">
    This is the answer!
  </div>
</div>
</div>

我仍然得到同样的东西。** **我把它改成了

[
  {
    'type': 'some type',
    'callback': this.someCallback
  },
  {
    'type': 'another type',
    'callback': this.anotherCallback
  }
]

1 个答案:

答案 0 :(得分:0)

我检查了您的代码,并将管道调用loop { rearr0 = generateNewImageVector() reimg0 = Image.fromarray(rearr0, 'RGB') reimg0.show() } 替换为Get-BrokerSession

Write-Host

输出是(正确):$user = $Env:UserName Invoke-command -scriptblock {param([string]$LocalUser); Add-PSSnapin Citrix* ; Write-Host "mydomain\$($LocalUser)"} -ArgumentList $user 。注意:您可以使用COMPUTER1\Administrator产生相同的结果。

所以我认为你的调用有错误。我建议验证您的管理单元是否按预期加载,并使用"mydomain\$LocalUser"块保护您的执行以获取更多错误详细信息。

附带问题:您是否真的使用try/catch调用命令,还是仅仅是为了说明而编写的?为了正确地将您的凭证传递给-Credential "mydomain\service.account",您必须写下这样的内容:

Invoke-Command