Compare commits
No commits in common. "ab0cd24f89f5b16a35cc7a685b59d5fe5460289d" and "5e7e42a44655993b4975e9616b20ff2b8c8d0b59" have entirely different histories.
ab0cd24f89
...
5e7e42a446
|
@ -180,6 +180,33 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
||||||
|
|
||||||
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||||
|
%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 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
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
|
@ -192,48 +219,6 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
|
||||||
%eline%
|
|
||||||
echo %tstresult%
|
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
|
||||||
|
|
||||||
REM check LanguageMode
|
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
|
||||||
%eline%
|
|
||||||
echo FullLanguage mode not 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
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check Powershell core version
|
|
||||||
|
|
||||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
|
||||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
|
||||||
goto dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check antivirus and other errors
|
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
|
|
|
@ -219,6 +219,33 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
||||||
|
|
||||||
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||||
|
%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 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
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
|
@ -231,48 +258,6 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
|
||||||
%eline%
|
|
||||||
echo %tstresult%
|
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
|
||||||
|
|
||||||
REM check LanguageMode
|
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
|
||||||
%eline%
|
|
||||||
echo FullLanguage mode not 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
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check Powershell core version
|
|
||||||
|
|
||||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
|
||||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
|
||||||
goto dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check antivirus and other errors
|
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
|
|
|
@ -222,6 +222,33 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
||||||
|
|
||||||
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||||
|
%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 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
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
|
@ -234,48 +261,6 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
|
||||||
%eline%
|
|
||||||
echo %tstresult%
|
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
|
||||||
|
|
||||||
REM check LanguageMode
|
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
|
||||||
%eline%
|
|
||||||
echo FullLanguage mode not 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
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check Powershell core version
|
|
||||||
|
|
||||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
|
||||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
|
||||||
goto dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check antivirus and other errors
|
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
|
|
|
@ -212,6 +212,33 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
||||||
|
|
||||||
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||||
|
%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 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
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
|
@ -224,48 +251,6 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
|
||||||
%eline%
|
|
||||||
echo %tstresult%
|
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
|
||||||
|
|
||||||
REM check LanguageMode
|
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
|
||||||
%eline%
|
|
||||||
echo FullLanguage mode not 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
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check Powershell core version
|
|
||||||
|
|
||||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
|
||||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
|
||||||
goto dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check antivirus and other errors
|
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
|
|
|
@ -241,6 +241,33 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
||||||
|
|
||||||
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||||
|
%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 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
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
|
@ -253,48 +280,6 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
|
||||||
%eline%
|
|
||||||
echo %tstresult%
|
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
|
||||||
|
|
||||||
REM check LanguageMode
|
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
|
||||||
%eline%
|
|
||||||
echo FullLanguage mode not 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
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check Powershell core version
|
|
||||||
|
|
||||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
|
||||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
|
||||||
goto dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check antivirus and other errors
|
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
|
|
|
@ -247,6 +247,33 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
||||||
|
|
||||||
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||||
|
%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 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
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
|
@ -259,48 +286,6 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
|
||||||
%eline%
|
|
||||||
echo %tstresult%
|
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
|
||||||
|
|
||||||
REM check LanguageMode
|
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
|
||||||
%eline%
|
|
||||||
echo FullLanguage mode not 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
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check Powershell core version
|
|
||||||
|
|
||||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
|
||||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
|
||||||
goto dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check antivirus and other errors
|
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
|
|
|
@ -172,6 +172,33 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
||||||
|
|
||||||
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||||
|
%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 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
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
|
@ -184,48 +211,6 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
|
||||||
%eline%
|
|
||||||
echo %tstresult%
|
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
|
||||||
|
|
||||||
REM check LanguageMode
|
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
|
||||||
%eline%
|
|
||||||
echo FullLanguage mode not 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
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check Powershell core version
|
|
||||||
|
|
||||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
|
||||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
|
||||||
goto dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check antivirus and other errors
|
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
|
|
|
@ -177,6 +177,33 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
||||||
|
|
||||||
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||||
|
%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 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
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
|
@ -189,48 +216,6 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
|
||||||
%eline%
|
|
||||||
echo %tstresult%
|
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
|
||||||
|
|
||||||
REM check LanguageMode
|
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
|
||||||
%eline%
|
|
||||||
echo FullLanguage mode not 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
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check Powershell core version
|
|
||||||
|
|
||||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
|
||||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
|
||||||
goto dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check antivirus and other errors
|
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
|
|
|
@ -171,6 +171,33 @@ goto done2
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
||||||
|
|
||||||
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||||
|
%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 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 done2
|
||||||
|
)
|
||||||
|
|
||||||
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Elevate script as admin and pass arguments and preventing loop
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
|
@ -183,48 +210,6 @@ goto done2
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
|
||||||
%eline%
|
|
||||||
echo %tstresult%
|
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
|
||||||
|
|
||||||
REM check LanguageMode
|
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
|
||||||
%eline%
|
|
||||||
echo FullLanguage mode not 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 done2
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check Powershell core version
|
|
||||||
|
|
||||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
|
||||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
|
||||||
goto done2
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check antivirus and other errors
|
|
||||||
|
|
||||||
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 done2
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
|
|
|
@ -172,6 +172,33 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
|
:: Check PowerShell
|
||||||
|
|
||||||
|
REM :PStest: $ExecutionContext.SessionState.LanguageMode :PStest:
|
||||||
|
|
||||||
|
cmd /c "%psc% "$f=[io.file]::ReadAllText('!_batp!') -split ':PStest:\s*';iex ($f[1])"" | find /i "FullLanguage" %nul1% || (
|
||||||
|
%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 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
|
:: Elevate script as admin and pass arguments and preventing loop
|
||||||
|
|
||||||
%nul1% fltmc || (
|
%nul1% fltmc || (
|
||||||
|
@ -184,48 +211,6 @@ goto dk_done
|
||||||
|
|
||||||
::========================================================================================================================================
|
::========================================================================================================================================
|
||||||
|
|
||||||
:: Check PowerShell
|
|
||||||
|
|
||||||
::pstst $ExecutionContext.SessionState.LanguageMode :pstst
|
|
||||||
|
|
||||||
for /f "delims=" %%a in ('cmd /c "%psc% ""if ($PSVersionTable.PSEdition -ne 'Core') {$f=[io.file]::ReadAllText('!_batp!') -split ':pstst';iex ($f[1])}""" %nul6%') do (set tstresult=%%a)
|
|
||||||
|
|
||||||
if /i not "%tstresult%"=="FullLanguage" (
|
|
||||||
%eline%
|
|
||||||
echo %tstresult%
|
|
||||||
cmd /c "%psc% $ExecutionContext.SessionState.LanguageMode"
|
|
||||||
|
|
||||||
REM check LanguageMode
|
|
||||||
|
|
||||||
cmd /c "%psc% "$ExecutionContext.SessionState.LanguageMode"" | findstr /i "ConstrainedLanguage RestrictedLanguage NoLanguage" %nul1% && (
|
|
||||||
%eline%
|
|
||||||
echo FullLanguage mode not 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
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check Powershell core version
|
|
||||||
|
|
||||||
cmd /c "%psc% "$PSVersionTable.PSEdition"" | find /i "Core" %nul1% && (
|
|
||||||
echo Windows Powershell is needed for MAS but it seems to be replaced with Powershell core. Aborting...
|
|
||||||
goto dk_done
|
|
||||||
)
|
|
||||||
|
|
||||||
REM check antivirus and other errors
|
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
::========================================================================================================================================
|
|
||||||
|
|
||||||
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
:: Disable QuickEdit and launch from conhost.exe to avoid Terminal app
|
||||||
|
|
||||||
if %winbuild% GEQ 17763 (
|
if %winbuild% GEQ 17763 (
|
||||||
|
|
Loading…
Reference in New Issue