Цитата Arsenik77:
Не получилось запустить »
|
Проверяйте напрямую из powershell, но с учетом -ThrottleLimit, по умолчанию этот параметр равен 32
Цитата:
Specifies the maximum number of concurrent connections that can be established to run this command. If you omit this parameter or enter a value of 0, the default value, 32, is used.
|
Список машин не обязательно перечислять в строке, можно вынести в файл, а в строку запуска добавить чтение из файла:
Код:

icm -comp (gc machines.txt) -scr {(gwmi win32_operatingsystem).description}} -thrott 100
файл положить рядом со скриптом, а перечисление оформить по одной машине на строку...
А, да, совсем забыл, там ведь:
Цитата:
To create a PSSession or run commands on a remote computer, by default, the current user must be a member of the Administrators group on the remote computer. Credentials are sometimes required even when the current user is logged on to an account that is a member of the Administrators group.
|
и
Цитата:
If the current user is a member of the Administrators group on the remote computer, or can provide the credentials of a member of the Administrators group, use the Credential parameter of the New-PSSession, Enter-PSSession or Invoke-Command cmdlets to connect remotely.
|
Поэтому придется организовывать что-то вроде:
Код:

icm -comp SRV -cred SRV\Admin -scr {(gwmi win32_operatingsystem).description}}
В общем, не всё так просто с безопасностью...
Ну а раз уж:
Цитата Arsenik77:
Нашел другой вариант решения net view \\имя компа , только не знаю как записать в переменную 3-ю строчку »
|
то можно так:
Код:

@echo off
for /f "delims=" %%a in ('type machines.txt') do set pc=%%a&call :out
pause&exit /b
:out
for /f "skip=2 delims=" %%b in ('net view \\%pc%') do set var=%%b&goto next
:next
echo %pc% - %var%
exit /b
machines.txt - список машин, по одной на строку