1.在管理機上下載和安裝psexec
https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
2.在管理機上編寫bat腳本,存放在管理機的(c:\inssm.bat); 客戶端通過該腳本來安裝軟件包
@echo off net use x: \\10.97.xx.241\Share /user:username pwd x: REM “Replace your codes starts from here” Ec2Install.exe /sp- /silent /norestart REM “replace your codes end of here.” if %ERRORLEVEL% NEQ 0 goto failed echo "SSM agent updated DONE!" cd .. echo %computername% %date% %time% >> ComputerList.txt echo "Updating of SSM agent succeeded. " goto end :faile echo $%computername% %date% %time% >> ComputerList.txt echo "Updating of SSM agent failed. " :end c: net use x: /delete
3. 在管理機上通過psexec把bat腳本copy到遠端機器,並且通過腳本實現軟件包的安裝
PS C:\PSTools> .\PsExec.exe \\10.xx.xx.81 -u admin -p "password" -c -w c:/ "C:\inssm.bat"
Refer:
https://blog.csdn.net/cneducation/article/details/3997166
https://blog.csdn.net/Miss_Easy/article/details/47780797