我遇到一些麻煩與調用命令cmdlet的。我以我的域名身份登錄到本地計算機,該域名在$server
上具有管理權限。如果我手動輸入我的憑據,然後使用Invoke-Command,我得到的錯誤:調用命令的行爲澄清
Cannot open Service Control Manager on computer ''. This operation might require other privileges.
# Works
Get-Service -ComputerName $server-ErrorAction Ignore
# Doesn't work
$cred = Get-Credential
Invoke-Command -ComputerName localhost -ScriptBlock {param($serverIPAddress) Get-Service -ComputerName $server -ErrorAction Ignore} -Credential $cred -ArgumentList $server
是不是有什麼特別的內置憑據,使這項工作?
我希望避免打開PowerShell遠程處理,因爲我從來沒有使用過它,不知道我是否可以出售給IT團隊。謝謝你的解釋! – Vlad274
@ Vlad274認爲在Windows Server 2012及更高版本中,PowerShell遠程處理功能是開箱即用的。我認爲這是一個有力的論據,有利於實現這一目標,這似乎與其他猶豫不決的IT專業人員產生共鳴。 – briantist