以下是通过bat脚本实现自动创建shell启动部署脚本,同时包含shell启动、openssh安装、user用户创建。
1、创建一个文本例如a.bat将方框中的内容到a.bat
2、准备opennssh的安装插件
3、将a.bat、openssh插件同时放在同一级U盘中
4、电脑开机插入U盘,双击a.bat脚本实现自动部署
::关闭云桌面自启功能 del /f /s /q C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\"Start Menu"\Programs\Startup\
::创建shell启动脚本 echo @echo off > C:\Windows\shellstart.bat echo taskkill /f /im explorer.exe >nul 2>&1 >> C:\Windows\shellstart.bat echo cd /d C:\Program Files (x86)\fusion\FusionDesktop >nul 2>&1 >> C:\Windows\shellstart.bat echo start /B RDPConnector.WPF.exe >nul 2>&1 >> C:\Windows\shellstart.bat
::添加shell启动注册表 reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "shell" /t "REG_SZ" /d "explorer.exe,shellstart.bat" /f
::创建openssh用户及授权 net user user user /add /passwordchg:No net user user /active:yes wmic.exe UserAccount Where Name='user' Set PasswordExpires=false net localgroup administrators user /add
::安装opennssh软件 msiexec /i D:\OpenSSH-Win64-v9.5.0.0.msi
|