Новый участник
Сообщения: 6
Благодарности: 0
|
Профиль
|
Отправить PM
| Цитировать
Вот так выглядит код на текущий момент:
$storageDir = "\\fs01\Distrib\Бухгалтерские\Бухсофт 2014"
$webclient = New-Object System.Net.WebClient
$url = "http://download.buhsoft.ru/Zarplata2014.exe"
$file = "$storageDir\Zarplata2014.exe"
$webclient.DownloadFile($url,$file)
$sSourceFile = "\\fs01\Distrib\Бухгалтерские\Бухсофт 2014\Zarplata2014.exe"
$aDestPaths = '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Agor\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Niso\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Fina\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Koe\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Goe\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Empty\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Empty2\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Dsz\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Dso\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Dso2\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Dso3\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\abc\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\abc_auto\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\aa\Zarplata2014.exe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\bb\Zarplata2014.exe"
$aDestFolders = '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Agor", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Niso", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Fina", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Koe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Goe", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Empty", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Empty2", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Dsz", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Dso", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Dso2", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\Dso3", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\abc", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\abc_auto", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\aa", '
"\\fs01\Programs_Shared_Folder\Accounting\Buhsoft\Buhsoft2014\bb"
if(Test-Path -Path $sSourceFile -PathType Leaf) {
$aDestPaths | ForEach-Object -Process {
if(Test-Path -Path $_ -PathType Container) {
Copy-Item -Path $sSourceFile -Destination $_ -Force
} else {
Write-Host "Can't find destination path [$_]" -ForegroundColor Red
}
}
} else {
Write-Host "Can't find source file [$sSourceFile]" -ForegroundColor Red
}
В итоге файл скачивается и копируется во все нужные директории, далее нужно его запустить оттуда (сделав cd в текущую директорию запуска), не понимаю как. Буду благодарен за ответ!
|