Compare commits

..

2 Commits

Author SHA1 Message Date
WindowsAddict 3b739d7e2b Add malware check in Powershell test 2025-04-13 04:25:10 +05:30
WindowsAddict 8673fbbfda Add -nop -c with Powershell 2025-04-13 03:45:34 +05:30
10 changed files with 132 additions and 32 deletions

View File

@ -200,13 +200,12 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor
if /i not "%tstresult%"=="FullLanguage" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
echo %tstresult% echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
REM check LanguageMode REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
%eline%
echo FullLanguage mode not found in PowerShell. Aborting... echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes. echo If you have applied restrictions on Powershell then undo those changes.
echo: echo:
@ -222,6 +221,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power
goto dk_done goto dk_done
) )
REM check for Mal-ware that may cause issues with Powershell
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
echo "%%f"
echo Mal%blank%ware found, PowerShell is not working properly.
echo:
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
goto dk_done
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
@ -1068,7 +1078,7 @@ goto :dk_done
:dk_setvar :dk_setvar
set psc=powershell.exe set psc=powershell.exe -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
@ -11261,7 +11271,7 @@ set _tserror=
set winbuild=1 set winbuild=1
set "nul=>nul 2>&1" set "nul=>nul 2>&1"
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
set psc=powershell.exe set psc=powershell.exe -nop -c
set run_once= set run_once=
set t_name=Renewal Task set t_name=Renewal Task

View File

@ -239,13 +239,12 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor
if /i not "%tstresult%"=="FullLanguage" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
echo %tstresult% echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
REM check LanguageMode REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
%eline%
echo FullLanguage mode not found in PowerShell. Aborting... echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes. echo If you have applied restrictions on Powershell then undo those changes.
echo: echo:
@ -261,6 +260,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power
goto dk_done goto dk_done
) )
REM check for Mal-ware that may cause issues with Powershell
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
echo "%%f"
echo Mal%blank%ware found, PowerShell is not working properly.
echo:
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
goto dk_done
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
@ -799,7 +809,7 @@ goto :dk_done
:dk_setvar :dk_setvar
set psc=powershell.exe set psc=powershell.exe -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G

View File

@ -242,13 +242,12 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor
if /i not "%tstresult%"=="FullLanguage" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
echo %tstresult% echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
REM check LanguageMode REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
%eline%
echo FullLanguage mode not found in PowerShell. Aborting... echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes. echo If you have applied restrictions on Powershell then undo those changes.
echo: echo:
@ -264,6 +263,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power
goto dk_done goto dk_done
) )
REM check for Mal-ware that may cause issues with Powershell
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
echo "%%f"
echo Mal%blank%ware found, PowerShell is not working properly.
echo:
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
goto dk_done
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
@ -905,7 +915,7 @@ $key.SetAccessControl($acl)
:dk_setvar :dk_setvar
set psc=powershell.exe set psc=powershell.exe -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G

View File

@ -232,13 +232,12 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor
if /i not "%tstresult%"=="FullLanguage" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
echo %tstresult% echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
REM check LanguageMode REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
%eline%
echo FullLanguage mode not found in PowerShell. Aborting... echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes. echo If you have applied restrictions on Powershell then undo those changes.
echo: echo:
@ -254,6 +253,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power
goto dk_done goto dk_done
) )
REM check for Mal-ware that may cause issues with Powershell
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
echo "%%f"
echo Mal%blank%ware found, PowerShell is not working properly.
echo:
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
goto dk_done
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
@ -1327,7 +1337,7 @@ exit /b
:dk_setvar :dk_setvar
set psc=powershell.exe set psc=powershell.exe -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G

View File

@ -261,13 +261,12 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor
if /i not "%tstresult%"=="FullLanguage" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
echo %tstresult% echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
REM check LanguageMode REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
%eline%
echo FullLanguage mode not found in PowerShell. Aborting... echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes. echo If you have applied restrictions on Powershell then undo those changes.
echo: echo:
@ -283,6 +282,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power
goto dk_done goto dk_done
) )
REM check for Mal-ware that may cause issues with Powershell
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
echo "%%f"
echo Mal%blank%ware found, PowerShell is not working properly.
echo:
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
goto dk_done
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
@ -1646,7 +1656,7 @@ set _tserror=
set winbuild=1 set winbuild=1
set "nul=>nul 2>&1" set "nul=>nul 2>&1"
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G
set psc=powershell.exe set psc=powershell.exe -nop -c
set run_once= set run_once=
set t_name=Renewal Task set t_name=Renewal Task
@ -2332,7 +2342,7 @@ exit /b
:dk_setvar :dk_setvar
set psc=powershell.exe set psc=powershell.exe -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G

View File

@ -267,13 +267,12 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor
if /i not "%tstresult%"=="FullLanguage" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
echo %tstresult% echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
REM check LanguageMode REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
%eline%
echo FullLanguage mode not found in PowerShell. Aborting... echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes. echo If you have applied restrictions on Powershell then undo those changes.
echo: echo:
@ -289,6 +288,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power
goto dk_done goto dk_done
) )
REM check for Mal-ware that may cause issues with Powershell
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
echo "%%f"
echo Mal%blank%ware found, PowerShell is not working properly.
echo:
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
goto dk_done
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
@ -1955,7 +1965,7 @@ exit /b
:dk_setvar :dk_setvar
set psc=powershell.exe set psc=powershell.exe -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G

View File

@ -192,13 +192,12 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor
if /i not "%tstresult%"=="FullLanguage" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
echo %tstresult% echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
REM check LanguageMode REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
%eline%
echo FullLanguage mode not found in PowerShell. Aborting... echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes. echo If you have applied restrictions on Powershell then undo those changes.
echo: echo:
@ -214,6 +213,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power
goto dk_done goto dk_done
) )
REM check for Mal-ware that may cause issues with Powershell
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
echo "%%f"
echo Mal%blank%ware found, PowerShell is not working properly.
echo:
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
goto dk_done
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
@ -1343,7 +1353,7 @@ if ($appIdsList.Count -gt 0) {
:dk_setvar :dk_setvar
set psc=powershell.exe set psc=powershell.exe -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G

View File

@ -197,13 +197,12 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor
if /i not "%tstresult%"=="FullLanguage" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
echo %tstresult% echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
REM check LanguageMode REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
%eline%
echo FullLanguage mode not found in PowerShell. Aborting... echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes. echo If you have applied restrictions on Powershell then undo those changes.
echo: echo:
@ -219,6 +218,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power
goto dk_done goto dk_done
) )
REM check for Mal-ware that may cause issues with Powershell
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
echo "%%f"
echo Mal%blank%ware found, PowerShell is not working properly.
echo:
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
goto dk_done
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
@ -815,7 +825,7 @@ exit /b
:dk_setvar :dk_setvar
set psc=powershell.exe set psc=powershell.exe -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G

View File

@ -191,13 +191,12 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor
if /i not "%tstresult%"=="FullLanguage" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
echo %tstresult% echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
REM check LanguageMode REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
%eline%
echo FullLanguage mode not found in PowerShell. Aborting... echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes. echo If you have applied restrictions on Powershell then undo those changes.
echo: echo:
@ -213,6 +212,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power
goto done2 goto done2
) )
REM check for Mal-ware that may cause issues with Powershell
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
echo "%%f"
echo Mal%blank%ware found, PowerShell is not working properly.
echo:
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
goto done2
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
@ -723,7 +733,7 @@ exit /b
:dk_setvar :dk_setvar
set psc=powershell.exe set psc=powershell.exe -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G

View File

@ -192,13 +192,12 @@ for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Cor
if /i not "%tstresult%"=="FullLanguage" ( if /i not "%tstresult%"=="FullLanguage" (
%eline% %eline%
echo %tstresult% echo: %tstresult%
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode" cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
REM check LanguageMode REM check LanguageMode
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && ( cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
%eline%
echo FullLanguage mode not found in PowerShell. Aborting... echo FullLanguage mode not found in PowerShell. Aborting...
echo If you have applied restrictions on Powershell then undo those changes. echo If you have applied restrictions on Powershell then undo those changes.
echo: echo:
@ -214,6 +213,17 @@ echo Windows Powershell is needed for MAS but it seems to be replaced with Power
goto dk_done goto dk_done
) )
REM check for Mal-ware that may cause issues with Powershell
for /r "%ProgramFiles%\" %%f in (secureboot.exe) do if exist "%%f" (
echo "%%f"
echo Mal%blank%ware found, PowerShell is not working properly.
echo:
set fixes=%fixes% %mas%remove_mal%w%ware
call :dk_color2 %Blue% "Check this webpage for help - " %_Yellow% " %mas%remove_mal%w%ware"
goto dk_done
)
REM check antivirus and other errors REM check antivirus and other errors
echo PowerShell is not working properly. Aborting... echo PowerShell is not working properly. Aborting...
@ -1460,7 +1470,7 @@ exit /b
:dk_setvar :dk_setvar
set psc=powershell.exe set psc=powershell.exe -nop -c
set winbuild=1 set winbuild=1
for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G for /f "tokens=6 delims=[]. " %%G in ('ver') do set winbuild=%%G