.net package uninstall

Hi All,

I am trying to uninstall .net package from server where it’s installed version is greater than 4.7 or less than the version 4.7.

I have the bat file with the commands to uninstall.here is the script

I want to uninstall the dotnet using this bat file.Can you suggest me to create a task with this bat file?

Script:

Echo off
CLS
ECHO THIS SCRIPT WILL ATTEMPT TO UNINSTALL .NET 4.
IF EXIST “%windir%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Extended\setup.exe” goto DOTNETSILENTUNINSTALL32
IF EXIST “%windir%\Microsoft.NET\Framework64\v4.0.30319\SetupCache\Extended\setup.exe” goto DOTNETSILENTUNINSTALL64
GOTO ENDSILENTUNINSTALL

:DOTNETSILENTUNINSTALL32
echo .NET Framework 4 Full (32-bit) – silent uninstall underway - This will take several minutes. Please wait.
%windir%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Extended\setup.exe /uninstall /x86 /x64 /ia64 /parameterfolder Extended /q /norestart
%windir%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Client\setup.exe /uninstall /x86 /x64 /parameterfolder Client /q /norestart
GOTO ENDSILENTUNINSTALL

:DOTNETSILENTUNINSTALL64
echo .NET Framework 4 Full (64-bit) – silent uninstall underway - This will take several minutes. Please wait.
%windir%\Microsoft.NET\Framework64\v4.0.30319\SetupCache\Extended\setup.exe /uninstall /x86 /x64 /ia64 /parameterfolder Extended /q /norestart
%windir%\Microsoft.NET\Framework64\v4.0.30319\SetupCache\Client\setup.exe /uninstall /x86 /x64 /parameterfolder Client /q
GOTO ENDSILENTUNINSTALL

:ENDSILENTUNINSTALL
ECHO SILENT UNINSTALL COMPLETED
ECHO.
TIMEOUT.EXE 10

thank you,

Stay safe!

Regards,
Riyazbasha

@RiyazBasha, assuming that your script functions as expected, I’d use the createfile until ActionScript feature.

createfile until __EOF

Echo off
ECHO THIS SCRIPT WILL ATTEMPT TO UNINSTALL .NET 4.
IF EXIST “%windir%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Extended\setup.exe” goto DOTNETSILENTUNINSTALL32
IF EXIST “%windir%\Microsoft.NET\Framework64\v4.0.30319\SetupCache\Extended\setup.exe” goto DOTNETSILENTUNINSTALL64
GOTO ENDSILENTUNINSTALL

:DOTNETSILENTUNINSTALL32
echo .NET Framework 4 Full (32-bit) – silent uninstall underway - This will take several minutes. Please wait.
%windir%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Extended\setup.exe /uninstall /x86 /x64 /ia64 /parameterfolder Extended /q /norestart
%windir%\Microsoft.NET\Framework\v4.0.30319\SetupCache\Client\setup.exe /uninstall /x86 /x64 /parameterfolder Client /q /norestart
GOTO ENDSILENTUNINSTALL

:DOTNETSILENTUNINSTALL64
echo .NET Framework 4 Full (64-bit) – silent uninstall underway - This will take several minutes. Please wait.
%windir%\Microsoft.NET\Framework64\v4.0.30319\SetupCache\Extended\setup.exe /uninstall /x86 /x64 /ia64 /parameterfolder Extended /q /norestart
%windir%\Microsoft.NET\Framework64\v4.0.30319\SetupCache\Client\setup.exe /uninstall /x86 /x64 /parameterfolder Client /q
GOTO ENDSILENTUNINSTALL

:ENDSILENTUNINSTALL
ECHO SILENT UNINSTALL COMPLETED
ECHO.
TIMEOUT.EXE 10

__EOF

move __createfile YourScript.bat

Hope this helps.

Best,
@cmcannady

Thanks @cmcannady for the response.

How can i run this Yourscript.bat file?

You can utilize the waithidden command from the Action Script language to execute your BAT script. However, these are the other execution commands available in the Action Script language.

image