1

以下のスクリプトを使用して別のフォレストから portqry を実行したいのですが、パスが見つからないというエラーが表示されます。ネットワーク共有からファイルにアクセスしている間、リモートドメインから問題なく手動でアクセスできます

# フォレスト名取得

$domain = "spos02600287.test.net"
$contextType = [system.directoryservices.activedirectory.Directorycontexttype]::Domain
$domain ="$domain"
$domainContext = new-object system.directoryservices.ActiveDirectory.DirectoryContext @($contextType,$domain)
#Query  the Forest and PDC Role Emulator 
$Server = [system.DirectoryServices.Activedirectory.Domain]::GetDomain($domaincontext)
$passwords = "newtemp123"
$user =  "$domain\Administrator"
$password = $Passwords | ConvertTo-SecureString -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential -argument $user, $password

$PDC =$server.Name
foreach ( $serv in $PDC){

$Server =  "d.root-servers.net"
$Port = "53"

Invoke-Command -ComputerName $serv -Credential $creds  -ScriptBlock {\\10.28.64.15\EXE\portqry.exe -n $Server -e $Port -p UDP }}
4

2 に答える 2

0

この問題は-authentication credssp、以下のように呼び出しコマンドラインに追加するだけで解決されました

Invoke-Command -ComputerName $serv -Credential $creds -authentication credssp -ScriptBlock {...}
于 2014-10-20T18:18:41.330 に答える