自动化脚本(自用)——静默安装软件及设置BIOS密码、加域。。。

  • Post author:
  • Post category:其他


@ECHO OFF

title Auto script

rem 判断是否以管理员运行

net.exe session 1>NUL 2>NUL && (

goto README

) || (

goto not_admin

)

:not_admin

echo Please run this script as administrator.

pause

goto EOF

:README

cd “%~dp0

cd softwares

ECHO.

ECHO ******************************************************************************

ECHO.

ECHO Cytech PC Software Automatically Silently Installs

ECHO.

ECHO This script will automatically install the generic software for cytech PC .

ECHO.

ECHO ******************************************************************************

ECHO.

ECHO Please confirm the office version you need to install.

ECHO.

ECHO 1 – Office 2019

ECHO.

ECHO 2 – Office 2016

ECHO.

ECHO 3 – Don`t Install Office

ECHO.

ECHO 4 – Exit

ECHO.

echo ******************************************************************************

set INPUT=

set /P INPUT=Enter the option: %=%

IF “%INPUT%” == “1” (

GOTO INSTALL2019

)ELSE IF “%INPUT%” == “2” (

GOTO INSTALL2016

)ELSE IF “%INPUT%” == “3” (

GOTO SETUP1

)ELSE IF “%INPUT%” == “4” (

GOTO EOF

)ELSE “%INPUT%”==”” (

GOTO README

)

:INSTALL2019

cd Office2019

echo installing office2019…

echo.

setup.exe /configure configuration.xml

echo done…

echo.

cd…

choice /t 2 /d y /n >nul

GOTO SETUP1

:INSTALL2016

cd Office2016

echo installing office2016…

echo.

setup64.exe

echo done…

echo.

cd…

choice /t 2 /d y /n >nul

GOTO SETUP1

:SETUP1

rem 关闭UAC/仅有Admin下UAC更改,用户端不变。

echo change UAC settings…

reg add “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System” /v “ConsentPromptBehaviorAdmin” /t reg_dword /d 0 /F

reg add “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System” /v “PromptOnSecureDesktop” /t reg_dword /d 0 /F

echo done…

:SET_NAME

rem 设置计算机名

set computer_name=

set /p tmpp=Input new computer name:

set /P Key=Confirm new computer name:”%tmpp%”?(y/n):%=%

if “%Key%” == “y” (

@powershell.exe -command “Add-Computer -DomainName “global.cytech.com” -NewName “%tmpp%” -Credential Mli001-Radmin -Force”

) else if “%Key%” == “Y” (

@powershell.exe -command “Add-Computer -DomainName “global.cytech.com” -NewName “%tmpp%” -Credential Mli001-Radmin -Force”

) else (

goto SET_NAME

)

echo installing Dell-Command-Configure…

echo.

start /wait /min Dell-Command-Configure.EXE /S

echo done…

echo.

GOTO SET_PWD

:SET_PWD

rem setup bios and admin password***********************************************

set new_password=

set confirm_password=

echo Setup 1 — Set up BIOS and Admin’s password:

set “psCommand=powershell -Command “$new_password = read-host ‘Enter password’ -AsSecureString ; ^




B S T R = [ S y s t e m . R u n t i m e . I n t e r o p S e r v i c e s . M a r s h a l ] : : S e c u r e S t r i n g T o B S T R ( BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR(






B


S


T


R






版权声明:本文为weixin_42494071原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。