Junos
18-07-2014, 22:30
Например выполняется код на Win7:
$session3 = New-PSSession -ConnectionUri $uri3 -Credential $credential
$command = {Get-ADDomain | Select-Object -ExpandProperty Forest}
$domainok = Invoke-Command -Session $session3 -Scriptblock $command
Remove-PSSession $session3
На хост машине "Get-ADDomain" нету. Соответственно получаю ошибку
The term 'Get-ADDomain' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.
+ CategoryInfo : ObjectNotFound: (Get-ADDomain:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Но на удаленном сервере (Win2012R2) эта команда есть. Вопрос в том - как обойти это?
$session3 = New-PSSession -ConnectionUri $uri3 -Credential $credential
$command = {Get-ADDomain | Select-Object -ExpandProperty Forest}
$domainok = Invoke-Command -Session $session3 -Scriptblock $command
Remove-PSSession $session3
На хост машине "Get-ADDomain" нету. Соответственно получаю ошибку
The term 'Get-ADDomain' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.
+ CategoryInfo : ObjectNotFound: (Get-ADDomain:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Но на удаленном сервере (Win2012R2) эта команда есть. Вопрос в том - как обойти это?