简体   繁体   English

批量自动化应用程序安装

[英]Automating Application Installations in Batch

I am trying to write a Script that will install our remote app applications automatically. 我正在尝试编写一个脚本,该脚本将自动安装我们的远程应用程序。 Here is what I have so far: 这是我到目前为止的内容:

REM Install Remote Icons
@Echo On
pushd "\\Servername.com\it\RDP\Installers\"
start msiexec /i "\\Servername.com\it\RDP\Installers\ExercisePro.msi" /qn
start msiexec /i "\\Servername.com\it\RDP\Installers\Excel.msi" /qn
start msiexec /i "\\Servername.com\it\RDP\Installers\Word.msi" /qn
start msiexec /i "\\Servername.com\it\RDP\Installers\Outlook.msi" /qn
start msiexec /i "\\Servername.com\it\RDP\Installers\Allscripts EHR.msi" /qn
start msiexec /i "\\Servername.com\it\RDP\Installers\Allscripts PM.msi" /qn
start msiexec /i "\\Servername.com\it\RDP\Installers\MModal Allscripts EHR.msi" /qn
popd

mkdir C:\Users\%USERNAME%\Icons

copy C:\Users\%USERNAME%\%APPDATA%\Local\Microsoft\Installer   C:\Icons

pushd "\\Servername.com\M Modal\Fluency.Direct.9.1.65.7.6.4.v7\fd.client\install_silent.bat"
popd

copy \\Servername.com\Private IT\PC_Shortcuts  \\%COMPUTERNAME%\%USERNAME%\Public\Desktop

pause

So far the script is not working as I intended it. 到目前为止,脚本无法正常运行。 I want it to install the applications then I want it to make a directory called C:\\Icons and copy the app data over to that folder so I can delete the appdata entries that it makes and those entries take the user profile longer to login. 我希望它安装应用程序,然后让它创建一个名为C:\\ Icons的目录,并将应用程序数据复制到该文件夹​​中,以便我可以删除其创建的appdata条目,并且这些条目需要更长的用户配置文件登录时间。 Also I have a folder on the server that I want to copy to the local desktop that has all of the internet shortcuts we use. 另外,我在服务器上有一个文件夹要复制到本地桌面,该文件夹包含我们使用的所有Internet快捷方式。 This is also not working correctly :( 这也不能正常工作:(

This should work for you. 这应该为您工作。

Also do you really need all the pushd and popd if you are providing the full location of the sources you are copying. 如果要提供要复制的源的完整位置,您是否真的需要所有推送和弹出操作。 If you are executing a file, and calling it by it's full Universal Naming Convention (ie C:\\Folder\\Test.txt) then you don't need to change your current directory to C:\\Folder, you can run that file from anywhere within the computers file system, as you are providing the full file location. 如果您正在执行文件,并通过完整的通用命名约定(即C:\\ Folder \\ Test.txt)进行调用,则无需将当前目录更改为C:\\ Folder,则可以从以下位置运行该文件:提供完整的文件位置时,计算机文件系统中的任何位置。

If you want to run the file by only providing the filename, or a partial address to the file, you would then need to change to the directory the file is residing in, or provide the location to the director from where you are located. 如果要仅通过提供文件名或文件的部分地址来运行文件,则需要更改到文件所在的目录,或将位置提供给控制器。 (ie if you are in C:\\Folder1 and the file resides in C:\\Folder1\\Folder2\\Folder3\\File.txt you would need to use the following address .\\Folder2\\Folder3\\File.txt as you are already located in C:\\Folder1 and the .\\ acts as a placeholder\\variable for the current directory you are sitting in). (即,如果您位于C:\\ Folder1中,并且文件位于C:\\ Folder1 \\ Folder2 \\ Folder3 \\ File.txt中,则您需要使用以下地址。\\ Folder2 \\ Folder3 \\ File.txt,因为您已经位于C:\\ Folder1和。\\充当您所在的当前目录的占位符\\变量)。

REM Install Remote Icons
@Echo On

msiexec /i "\\Servername.com\it\RDP\Installers\ExercisePro.msi" /qn /norestart
msiexec /i "\\Servername.com\it\RDP\Installers\Excel.msi" /qn /norestart
msiexec /i "\\Servername.com\it\RDP\Installers\Word.msi" /qn /norestart
msiexec /i "\\Servername.com\it\RDP\Installers\Outlook.msi" /qn /norestart
msiexec /i "\\Servername.com\it\RDP\Installers\Allscripts EHR.msi" /qn /norestart
msiexec /i "\\Servername.com\it\RDP\Installers\Allscripts PM.msi" /qn /norestart
msiexec /i "\\Servername.com\it\RDP\Installers\MModal Allscripts EHR.msi" /qn /norestart

Call "\\Servername.com\M Modal\Fluency.Direct.9.1.65.7.6.4.v7\fd.client\install_silent.bat"

mkdir C:\Users\%USERNAME%\Icons

copy C:\Users\%USERNAME%\%APPDATA%\Local\Microsoft\Installer\*.* C:\Users\%USERNAME%\Icons /Y

copy \\Servername.com\Private IT\PC_Shortcuts\*.* \\%COMPUTERNAME%\%USERNAME%\Public\Desktop /Y

pause

NOTE: I have added in the /norestart to ensure that your device doesn't restart after any of the installations, which would then in turn kill the installation script. 注意: 我已经在/ norestart中添加了以确保您的设备在任何安装后都不会重新启动,这反过来会杀死安装脚本。

You can use powershell remoting for this tasks. 您可以将Powershell远程处理用于此任务。 Check invoke-command with the -ComputerName parameter for remote actions. 检查带有-ComputerName参数的invoke-command的远程操作。 With Powershell version 5 Copy-Item supports FromSession ToSession parameters to copy files remotely. 在Powershell版本5中, Copy-Item支持FromSession ToSession参数来远程复制文件。 You can run msiexec via Start-Process . 您可以通过Start-Process运行msiexec。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM