HFShak
16-12-2011, 09:41
Добрый день!
Подскажите, почему этот скрипт:
import-module ActiveDirectory
Get-ADComputer `
-Filter * `
-SearchBase 'DC=rd,DC=ru' `
-SearchScope Subtree `
-Properties `
name, operatingSystem `
| select-object `
-property `
@{Name = "Name"; Expression = {$_.name;}}, `
@{Name = "OS"; Expression = {$_.operatingSystem;}} `
| out-File c:\AD_PC.txt
.. выгружает нормально, а если добавить еще один параметр выгрузки пишет ошибку? Например так:
import-module ActiveDirectory
Get-ADComputer `
-Filter * `
-SearchBase 'DC=rd,DC=ru' `
-SearchScope Subtree `
-Properties `
name, operatingSystem, operatingSystemServicePack `
| select-object `
-property `
@{Name = "Name"; Expression = {$_.name;}}, `
@{Name = "OS"; Expression = {$_.operatingSystem;}} `
@{Name = "OS Version"; Expression = {$_.operatingSystemServicePack;}} `
| out-File c:\AD_PC.txt
Ошибка:
Select-Object : Не удается найти позиционный параметр, принимающий аргумент "System.Collections.Hashtable".
строка:7 знак:16
+ | select-object <<<< `
+ CategoryInfo : InvalidArgument: (: ) [Select-Object], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SelectObjectCommand
Подскажите, почему этот скрипт:
import-module ActiveDirectory
Get-ADComputer `
-Filter * `
-SearchBase 'DC=rd,DC=ru' `
-SearchScope Subtree `
-Properties `
name, operatingSystem `
| select-object `
-property `
@{Name = "Name"; Expression = {$_.name;}}, `
@{Name = "OS"; Expression = {$_.operatingSystem;}} `
| out-File c:\AD_PC.txt
.. выгружает нормально, а если добавить еще один параметр выгрузки пишет ошибку? Например так:
import-module ActiveDirectory
Get-ADComputer `
-Filter * `
-SearchBase 'DC=rd,DC=ru' `
-SearchScope Subtree `
-Properties `
name, operatingSystem, operatingSystemServicePack `
| select-object `
-property `
@{Name = "Name"; Expression = {$_.name;}}, `
@{Name = "OS"; Expression = {$_.operatingSystem;}} `
@{Name = "OS Version"; Expression = {$_.operatingSystemServicePack;}} `
| out-File c:\AD_PC.txt
Ошибка:
Select-Object : Не удается найти позиционный параметр, принимающий аргумент "System.Collections.Hashtable".
строка:7 знак:16
+ | select-object <<<< `
+ CategoryInfo : InvalidArgument: (: ) [Select-Object], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SelectObjectCommand