當我運行下面的腳本中使用的追求廣告提取OU信息命令行開關它給了我一個錯誤,如下無法查詢[GET-QADComputer]遠程PS會話(PowerShell的)信息
Object reference not set to an instance of an object.
+ CategoryInfo : NotSpecified: (:) [Get-QADComputer], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.GetComputerCmdlet
下面是正在使用的腳本
$password = convertTo-secureString -string "123" -asPlainText -force
$credential = new-object System.Management.automation.Pscredential ("test.com\sh" , $password)
$session = New-PSSession -computername CI -credential $credential -port 5985 -Authentication Default
Invoke-Command -Session $session -ScriptBlock {
Add-PSSnapin Quest.ActiveRoles.ADManagement
$ou = get-qadcomputer QUAG | select -ExpandProperty canonicalname
}
$adou= (Invoke-Command -Session $session -ScriptBlock { $ou })
Get-PSSession | Remove-PSSession
$adou
有人可以幫我一下嗎?
謝謝!
你是上帝:)謝謝!它工作真棒! – PowerShell
Hi @Shay Levy你能幫我解決這個問題嗎?http://stackoverflow.com/questions/7021326/combining-output-of-two-cmdlets-to-get-a-common-output – PowerShell
我很喜歡但我不熟悉網絡應用程序命令行:( –