This script for VMManager Windows OS Template is true or not?

Anonymous
2021-04-09T12:54:45.027+00:00

There is an OS template script for ISPSystem VMManager. It looks like this:

@echo off
setlocal EnableDelayedExpansion

set logfile=C:\setup.log

del /f c:\ifacename.txt

for /f "skip=2 tokens=2,4*" %%A in ('netsh interface show interface') do (
  if "%%A" == "Connected" (
    echo %%B %%C>> c:\ifacename.txt
  )
)

set /P IFACENAME=< c:\ifacename.txt

echo Trimming

set IFACENAME=%IFACENAME%##
set IFACENAME=%IFACENAME:    ##=##%
set IFACENAME=%IFACENAME:  ##=##%
set IFACENAME=%IFACENAME: ##=##%
set IFACENAME=%IFACENAME:##=%

del /f c:\ifacename.txt

echo --- Interface name: %IFACENAME% >> %logfile%

echo --- set Administartor password >> %logfile%

net user Administrator ($PASS)  >> %logfile%
echo ------Set static IP-------------------------------------[%DATE%-%TIME%]      > %logfile%
echo --- IP/NM=($IP)/($NETMASK)  GW=($GATEWAY)      >> %logfile%
echo --- NS1=($NAMESERVER)                                                   >> %logfile%

set "nexthop=($NEXTHOPIPv4)"

IF "%nexthop%"=="()" (
        set "nexthop=NONE"
)
echo %nexthop% | findstr /c:( 1>nul
IF NOT ERRORLEVEL 1 (
        set "nexthop=NONE"
)

IF (%nexthop%) == () (
        set "nexthop=NONE"
)

if (%nexthop%) == (NONE) (
        netsh interface ip set address    "%IFACENAME%" static ($IP) ($NETMASK) ($GATEWAY)  >> %logfile%
) ELSE (
        netsh interface ip set address    "%IFACENAME%" static ($IP) 255.255.255.255 ($NEXTHOPIPv4)  >> %logfile%
)

netsh interface ip add dnsservers "%IFACENAME%" ($NAMESERVER)          >> %logfile%

set "nslist=($NAMESERVERS)"

IF "%nslist%"=="()" (
        set "nslist=NEX"
)
echo %nslist% | findstr /c:( 1>nul
IF NOT ERRORLEVEL 1 (
        set "nslist=NEX"
)

if NOT "%nslist%"=="" ( 
        IF NOT "%nslist%"=="NEX" (
                set flist=%nslist:"=%
                echo NAMESERVERS: !flist! >> %logfile%
REM                netsh interface ip delete dnsservers "%IFACENAME%" all >> %logfile%
                FOR %%i IN (!flist!) DO (
                        echo %%i >> %logfile%
                        echo %%i | findstr /c:: 1>nul
                        if ERRORLEVEL 1 (
                                echo ipv4 >> %logfile%
                                netsh interface ip add dnsservers "%IFACENAME%" %%i >> %logfile%
                        ) ELSE (
                                echo ipv6 >> %logfile%
                                netsh interface ipv6 add dnsservers "Ethernet" %%i >> %logfile%
                        )
                )
        ) ELSE (
                echo BRACERS >> %logfile%
        )
) ELSE (
        echo EMPTY >> %logfile%
)

set extendfile=C:\vmmgr\extend.txt
echo --- resize disk >> %logfile%
echo select volume 1 > %extendfile%
echo extend noerr >> %extendfile%
diskpart.exe /s %extendfile% >> %logfile%

set "pkey=($PRODUCTKEY)"

IF NOT "%pkey%" == "" (
        IF NOT "%pkey%" == "()" (
                echo "PKEY is not null. Activating license"
                echo activate windows >> %logfile%
                cscript %windir%\system32\slmgr.vbs -ipk %pkey%
                cscript %windir%\system32\slmgr.vbs -ato
        ) ELSE (
                echo "PKEY is bracers" >> %logfile%
        )
) ELSE (
        echo "PKEY is EMPTY" >> %logfile%
)

echo remove task vmmgr_firstrun >> %logfile%
schtasks /Delete /TN "vmmgr_firstrun" /F  >> %logfile%
echo restart OS >> %logfile%
echo ------END--------------------------------------------------[%DATE%-%TIME%]     >> %logfile%

REM Russian language
REM echo $lang = "ru-RU" >> C:\vmmgr\lang.ps1
REM echo $langpack = Get-ChildItem "C:\vmmgr\langs\*language*$lang.cab" >> \vmmgr\lang.ps1
REM echo Dism /Online /Add-Package /PackagePath:"$langpack" >> C:\vmmgr\lang.ps1
REM echo Set-WinSystemLocale $lang >> c:\vmmgr\lang.ps1
REM echo Set-WinUILanguageOverride $lang >> c:\vmmgr\lang.ps1
REM echo $oldList = Get-WinUserLanguageList >> c:\vmmgr\lang.ps1
REM echo $oldList.Add($lang) >> c:\vmmgr\lang.ps1
REM echo Set-WinUserLanguageList $oldList -force >> c:\vmmgr\lang.ps1
REM powershell.exe c:\vmmgr\lang.ps1 >> %logfile%

REM Enable RDP
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
netsh firewall set service remotedesktop enable

echo RMDIR /s /Q  C:\vmmgr >> c:\del.cmd
echo shutdown /r >> c:\del.cmd
cmd /c c:\del.cmd

This script is true or not?

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,127 questions
Windows 10 Setup
Windows 10 Setup
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
1,903 questions
Windows Server Setup
Windows Server Setup
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
241 questions
{count} votes