|
|
@ -180,40 +180,43 @@ goto dk_done |
|
|
|
|
|
|
|
::======================================================================================================================================== |
|
|
|
|
|
|
|
:: Elevate script as admin and pass arguments and preventing loop |
|
|
|
|
|
|
|
%nul1% fltmc || ( |
|
|
|
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b |
|
|
|
%eline% |
|
|
|
echo This script needs admin rights. |
|
|
|
echo Right click on this script and select 'Run as administrator'. |
|
|
|
goto dk_done |
|
|
|
) |
|
|
|
|
|
|
|
::======================================================================================================================================== |
|
|
|
|
|
|
|
:: Check PowerShell |
|
|
|
|
|
|
|
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest: |
|
|
|
::pstst $ExecutionContext.SessionState.LanguageMode :pstst |
|
|
|
|
|
|
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || ( |
|
|
|
for /f "delims=" %%a in ('cmd /c "%psc% ""$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])""" %nul6%') do (set tstresult=%%a) |
|
|
|
|
|
|
|
if /i "%tstresult%"=="ConstrainedLanguage" ( |
|
|
|
%eline% |
|
|
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" |
|
|
|
echo: |
|
|
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | find /i "FullLanguage" %nul1% && ( |
|
|
|
echo Failed to run Powershell command but Powershell is working. |
|
|
|
echo: |
|
|
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" |
|
|
|
echo: |
|
|
|
set fixes=%fixes% %mas%troubleshoot |
|
|
|
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" |
|
|
|
) || ( |
|
|
|
echo PowerShell is not working. Aborting... |
|
|
|
echo ConstrainedLanguage mode found in PowerShell. Aborting... |
|
|
|
echo If you have applied restrictions on Powershell then undo those changes. |
|
|
|
echo: |
|
|
|
set fixes=%fixes% %mas%fix_powershell |
|
|
|
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%fix_powershell" |
|
|
|
) |
|
|
|
goto dk_done |
|
|
|
) |
|
|
|
|
|
|
|
::======================================================================================================================================== |
|
|
|
|
|
|
|
:: Elevate script as admin and pass arguments and preventing loop |
|
|
|
|
|
|
|
%nul1% fltmc || ( |
|
|
|
if not defined _elev %psc% "start cmd.exe -arg '/c \"!_PSarg!\"' -verb runas" && exit /b |
|
|
|
if /i not "%tstresult%"=="FullLanguage" ( |
|
|
|
%eline% |
|
|
|
echo This script needs admin rights. |
|
|
|
echo Right click on this script and select 'Run as administrator'. |
|
|
|
echo "%tstresult%" |
|
|
|
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" |
|
|
|
echo PowerShell is not working properly. Aborting... |
|
|
|
cmd /c "%psc% ""$av = Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct; $n = @(); foreach ($i in $av) { if ($i.displayName -notlike '*windows*') { $n += $i.displayName } }; if ($n) { Write-Host ('Installed 3rd party Antivirus might be blocking the script - ' + ($n -join ', ')) -ForegroundColor White -BackgroundColor Blue }""" |
|
|
|
echo: |
|
|
|
set fixes=%fixes% %mas%troubleshoot |
|
|
|
call :dk_color2 %Blue% "Help - " %_Yellow% " %mas%troubleshoot" |
|
|
|
goto dk_done |
|
|
|
) |
|
|
|
|
|
|
|